Open tombee opened 3 months ago
The above shown data in routes
is clearly invalid, because for an optional
Terraform property the property shouldn't show up at all. That's why removing the empty string ""
will solve the shown error by pulumi
.
CC: @t0yv0
Thank you for reporting this issue so clearly and thanks for the cited workaround! I'm adding the appropriate labels. This is indeed common theme of issues, our team will need to tackle as time permits. Adding to a tracking issue.
I've created a repository here with a minimal configuration to reproduce this issue: https://github.com/tombee/pulumi-aws-issue-3986
Interestingly I found that it's only preventing preview and up actions when I add:
opts=pulumi.ResourceOptions(ignore_changes=["routes"]
It also about failed validation during pulumi import
of the route table:
Diagnostics:
aws:ec2:RouteTable (pulumi-import-issue-3986-rtb):
warning: One or more imported inputs failed to validate. This is almost certainly a bug in the `aws` provider. The import will still proceed, but you will need to edit the generated code after copying it into your program.
warning: aws:ec2/routeTable:RouteTable resource 'pulumi-import-issue-3986-rtb' has a problem: "" is not a valid CIDR block: invalid CIDR address: . Examine values at 'pulumi-import-issue-3986-rtb.routes'.
Updated the main issue comment, since I don't believe this is a blocking issue if the trigger is only when ignore_changes=["routes"]
is added, since the RouteTable resource has a built-in method of ignoring routes by simply omitting the input.
I don't know enough about how import works with pulumi-aws and the terraform bridge to know if this could be a wider issue though where the import CLI is producing a state that won't pass validation.
I just tried to reproduce this using the latest https://github.com/pulumi/pulumi-terraform-bridge/tree/master and it looks like it has been fixed.
After the next bridge release we can pull in the new version and test it out to confirm.
Tracking https://github.com/pulumi/pulumi-terraform-bridge/issues/2314 in the bridge.
Update: 28 May '24
It looks as though this specific issue is triggered when using
ignore_changes=["routes"]
after doingpulumi import
on a RouteTable resourceAccording to the docs, by omitting the routes input, this should then ignore route changes. I've tried this and it looks to be working okay for our use case.
For now it looks as though this isn't a blocking issue for importing Route Tables since there is a workaround, it's probably just not ideal that import is producing an invalid resource state that cannot be validated as per @tmeckel's reply: https://github.com/pulumi/pulumi-aws/issues/3986#issuecomment-2129313732
Latest info and steps to repro are in: https://github.com/pulumi/pulumi-aws/issues/3986#issuecomment-2130139319
What happened?
Not sure if this is a pulumi-aws or upstream Terraform problem!
When pulumi importing an AWS Route Table with AWS Classic (
aws:ec2/routeTable:RouteTable
), it appears that it also imports routes associated with the route table. The attributes on a route are set to "" if there is no value associated. I’m seeing an issue where "ipv6CidrBlock": "" then causes pulumi preview to complain that "" is not a valid CIDR block: invalid CIDR address.When I
pulumi state edit
and remove theipv6CidrBlock: "",
line from theaws:ec2/routeTable:RouteTable
resources the error goes away.If I also compare a
aws:ec2/routeTable:RouteTable
created bypulumi up
vs an imported resource viapulumi import
, the fields without values are all""
in the imported version and not present in thepulumi up
.Example
Section of state where the empty strings are being added to route attributes:
Output of
pulumi about
Additional context
Discussed this a little bit on Slack: https://pulumi-community.slack.com/archives/C84L4E3N1/p1715987354126929
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).