How to ask for help
1 min read

How to ask for help

Scott does something amazing. When he’s stuck, or runs into a problem that he needs help with, he posts a message in a group Slack.

It starts off with the Backstory to give the reader some context and insight into the issue. Then he documents the Problem, and includes any errors (in case the reader recognizes the error, or wants to google it from themselves). Finally he posts some Code snippets to show his work, helping the reader to understand exactly what’s being run.

Not only does this help me, to help Scott better, it’s more searchable in Slack for others if they run into similar problems.

So the next time you need help, please, be more Scott Houglum.


Here's an example:

Hey Dave, I'm wanting to add cors_rules to a storage account.  I am assuming since we'll have different amounts of rules per storage account depending on environment that a dynamic block is best here...

main.tf

blob_properties {
    dynamic "cors_rule" {
      for_each  = lookup(var.blob_cors_rule, terraform.workspace)
      allowed_origins = cors_rule.value["allowed_origins"]
      allowed_methods = cors_rule.value["allowed_methods"]
      allowed_headers = cors_rule.value["allowed_headers"]
      exposed_headers = cors_rule.value["exposed_headers"]
      max_age_in_seconds = cors_rule.value["max_age_in_seconds"]
    }
  }

var.tf

variable "blob_cors_rule" {
  type = map(object({
    allowed_headers    = string
    allowed_methods    = string
    allowed_origins    = string
    exposed_headers    = string
    max_age_in_seconds = number
  }))
  default = null
}

wus2.tfvars

blob_cors_rule = {
  dev = [{
    allowed_origins = ["http://localhost:3000"]
    allowed_methods = ["GET"]
    allowed_headers = ["Access-Control-Allow-Origin"]
    exposed_headers = ["*"]
    max_age_in_seconds = 3600
  },
  {
    allowed_origins = ["https://www.someurl.com"]
    allowed_methods = ["GET"]
    allowed_headers = ["Access-Control-Allow-Origin"]
    exposed_headers = ["*"]
    max_age_in_seconds = 3600
  }],
  qa = [{
    allowed_origins = ["http://localhost:3000"]
    allowed_methods = ["GET"]
    allowed_headers = ["Access-Control-Allow-Origin"]
    exposed_headers = ["*"]
    max_age_in_seconds = 3600
  },
  {
    allowed_origins = ["https://www.someurl.com"]
    allowed_methods = ["GET"]
    allowed_headers = ["Access-Control-Allow-Origin"]
    exposed_headers = ["*"]
    max_age_in_seconds = 3600
  }]
unfortunately I'm getting these errors for all items...
│ Error: Unsupported argument
│
│   on main.tf line 224, in resource "azurerm_storage_account" "storage_account":
│  224:       max_age_in_seconds = var.blob_cors_rule.value["max_age_in_seconds"]
│
│ An argument named "max_age_in_seconds" is not expected here.
Thanks