Skip to content

Support typed structs inside dynamic iterators #2013

Open
@a0s

Description

@a0s

Not sure is it bug or feature

This is not working

const resolverEndpoint = new Route53ResolverEndpoint(this, "resolver_endpoint", <Route53ResolverEndpointConfig>{
      provider: config.provider,
      direction: "INBOUND",
      securityGroupIds: [this.resolverSecurityGroup.id],
      ipAddress: subnetIdsIterator.dynamic(<Route53ResolverEndpointIpAddress>{
        subnetId: subnetIdsIterator.key
      }),
      tags: {
        Name: "vpn-resolver"
      }
    })
│ Error: Extraneous JSON object property
│ 
│   on cdk.tf.json line 1859, in resource.aws_route53_resolver_endpoint.vpn_endpoint_resolver_endpoint_61EF1F6A.dynamic.ip_address.content:
│ 1859:               "subnetId": "${each.key}"
│ 
│ No argument or block type is named "subnetId". Did you mean "subnet_id"?
╵
╷
│ Error: Missing required argument
│ 
│   on cdk.tf.json line 1860, in resource.aws_route53_resolver_endpoint.vpn_endpoint_resolver_endpoint_61EF1F6A.dynamic.ip_address.content:
│ 1860:             },
│ 
│ The argument "subnet_id" is required, but no definition was found.

But this works ok (but my perfectionism suffers at this point due to the use of an untyped struct)

const resolverEndpoint = new Route53ResolverEndpoint(this, "resolver_endpoint", <Route53ResolverEndpointConfig>{
      provider: config.provider,
      direction: "INBOUND",
      securityGroupIds: [this.resolverSecurityGroup.id],
      ipAddress: subnetIdsIterator.dynamic({
        subnet_id: subnetIdsIterator.key
      }),
      tags: {
        Name: "vpn-resolver"
      }
    })

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug/has-workaroundA bug with a workaround (may not be elegant)cdktffeature/iteratorshelp wantedCommunity contributions welcome as the core team is unlikely to work on this soonpriority/backlogLow priority (though possibly still important). Unlikely to be worked on within the next 6 months.size/smallestimated < 1 dayux/configuration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions