question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Incorrect attribute value type"

See original GitHub issue

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave “+1” or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

cdktf & Language Versions

cdktf: 0.0.12 typescript: Version 3.9.7

Affected Resource(s)

cdk deploy

Debug Output

https://gist.github.com/pmartindev/a5a741043975855a2a1a6fcacf4f549a

Expected Behavior

I would expect the file to create default/null values for the cdk.json and the cdk deploy to succeed

Actual Behavior

Executing cdk deploy produces the above error.

Steps to Reproduce

  1. Create an AWS security group construct (see: https://gist.github.com/pmartindev/b1ab0aa678678b11aadc30a3b23859d0)
  2. run the cdk deploy command
  3. Check output to see that the error is shown, and the cdk.tf.json does not contain the values that the error message specifies (see: https://gist.github.com/pmartindev/c9e93ffa5c7fa8c939b07252c9e90bcf)

Important Factoids

This appears to be an issue with the Terraform .json files. A workaround is to set the values to null, however, this is not possible with Typescript.

UPDATE: Adding the missing attributes with null values in the cdk.tf.json allows the terraform file to run correctly.

https://gist.github.com/pmartindev/314d083116776634ee4b4a5f07f40c95

References

https://github.com/terraform-providers/terraform-provider-aws/issues/8786

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
pmartindevcommented, Jul 21, 2020

Interesting. I will try it out and see if that works, thanks!

1reaction
skorfmanncommented, Jul 21, 2020

Exactly. After your other post, I was considering escape hatches, but if null values are dropped, then you’re correct, that won’t work.

I would say this is a pretty big issue, because at the moment, there is no way to create a security group with cdktf.

I stand corrected - undefined is filtered, null is not. I can synth this

    const sg = new SecurityGroup(this, 'albsg', {
      name: "tf-ecs-alb-sg",
      description: "Allows traffic to the ALB.",
      ingress: [{
        protocol: "tcp",
        fromPort: 80,
        toPort: 80,
        cidrBlocks: ["0.0.0.0/0"]
      }],
      egress: [{
        protocol: "-1",
        fromPort: 0,
        toPort: 0,
        cidrBlocks: ["0.0.0.0/0"]
      }],
    });

    sg.addOverride("ingress.0.description", null)

to this

      "ingress": [
          {
            "protocol": "tcp",
            "from_port": 80,
            "to_port": 80,
            "cidr_blocks": [
              "0.0.0.0/0"
            ],
            "description": null
          }
        ],
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why am I getting an 'Incorrect attribute value type' error when I ...
I'm getting an Incorrect attribute value type when I try to create a variable in TF. I'm on this version of TF: Terraform...
Read more >
terraform - Error: Incorrect attribute value type. Inappropriate ...
I'm unable to create 4 subnets within a vnet using type = list(map(string)) Error: Incorrect attribute value type │ │ on ...
Read more >
Error: Incorrect attribute value type · Issue #1170 - GitHub
vsphere_user is object with no attributes Inappropriate value for attribute "user": string required. Error: Incorrect attribute value type on ..
Read more >
Error messages on modules - DevOps Learning Community
Error: Incorrect attribute value type │ │ on .terraform/modules/virtual-network/main.tf line 8, in resource “azurerm_subnet” “subnet”:
Read more >
'Incorrect attribute value type System.String' while...
i get 'Incorrect attribute value type System.String' exception on the Guid id = _orgService.Create(crmInvoice); line of code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found