Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform variable with type object - type value not converted into json format #31

Open
tcondeixa opened this issue Oct 5, 2019 · 0 comments

Comments

@tcondeixa
Copy link

tcondeixa commented Oct 5, 2019

Use-case:
I'm using the CLI from terraform-config-inspect (json output) to generate documentation for modules using json parsing in the output.

Problem:
When using object type into variables the default is converted json but the type is not converted to json format.

Terraform Code Example:

variable "cors_rule" {
  description = "default cors rule defined for s3 bucket"
  type = object({
    max_age_seconds = number
    allowed_origins = list(string)
    allowed_methods = list(string)
    allowed_headers = list(string)
  })
  default = {
    max_age_seconds = 3000
    allowed_origins = [
      "*"]
    allowed_methods = [
      "GET",
      "PUT"]
    allowed_headers = [
      "*"]
  }
}

Output:

"cors_rule": {
      "name": "cors_rule",
      "type": "object({\n    max_age_seconds = number\n    allowed_origins = list(string)\n    allowed_methods = list(string)\n    allowed_headers = list(string)\n  })",
      "description": "default cors rule defined for s3 bucket",
      "default": {
        "allowed_headers": [
          "*"
        ],
        "allowed_methods": [
          "GET",
          "PUT"
        ],
        "allowed_origins": [
          "*"
        ],
        "max_age_seconds": 3000
      },
      "pos": {
        "filename": "variables.tf",
        "line": 121
      }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant