Open lorengordon opened 6 months ago
Voting for Prioritization
Volunteering to Work on This Issue
@kjenney Fyi since you opened the prior issue. What do you think about the proposal to add the values from the config to the state on import?
I'd love this, but I don't know how the CIDR association and the pool ID are linked via API after the VPC is provisioned.
They actually aren't linked directly via API, after the fact? My understanding is that you can destroy the IPAM, or delete the allocation, and the VPC itself is unaffected. And from the other direction, when you destroy the VPC, the IPAM resource discovery will "refresh" and realize the VPC is gone, and the allocation will be removed from the pool.
Terraform Core Version
1.7.4
AWS Provider Version
5.39.1
Affected Resource(s)
aws_vpc
Expected Behavior
I expect that if I import
aws_vpc
that its attributes should be accounted for in terraform state.Actual Behavior
The VPC is imported, but there is no VPC IPAM pool information imported in state.
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
kjenney/aws_vpc_ipam_test@main/main.tf - code to provision the VPC kjenney/aws_vpc_ipam_test@main/import/main.tf - code to re-provision it after the import
Steps to Reproduce
Save vpc_id from Outputs of apply. Use this in the next step:
Example: VPC_ID="vpc-122523421532"
Debug Output
Panic Output
No response
Important Factoids
Reopening #34304. That issue was closed as expected behavior for import when the API does not return the values on read. But I contend that import also writes to the state, and it does know the correct values in this case since they are in the config. Therefore, import should write the values from the config that it does not get from the API read.
References
#34304
Would you like to implement a fix?
None