Closed rwlodarczyk-xealth closed 1 month ago
Voting for Prioritization
Volunteering to Work on This Issue
Additionally, running aws route53 get-hosted-zone --id ZEXAMPLEZONE
shows that the VPC(s) from the other account are, in fact, associated with this zone. The ID displayed there is no different than the one used in the Terraform import statement. Output:
{
"HostedZone": {
"Id": "/hostedzone/ZEXAMPLEZONE",
"Name": "foo.bar.com.",
"CallerReference": "<guid>",
"Config": {
"Comment": "Internal hosts",
"PrivateZone": true
},
"ResourceRecordSetCount": 118
},
"VPCs": [
{
"VPCRegion": "us-west-2",
"VPCId": "vpc-0123456789abcdef0"
},
...
]
}
I also tried a "naked" ID (e.g. vpc-0123456789abcdef0
) and a "fully-qualified" ID (e.g. ZEXAMPLEZONE:vpc-0123456789abcdef0:us-west-2
), but these don't work either, with the former giving a format error as expected.
I could be wrong, but based on the example usage provided in the aws_route53_vpc_association_authorization
resource doc, it seems that the aws_route53_zone_association
object is supposed to be associated with the account which owns the VPC. I created a little diagram to illustrate it - account A owns the hosted zone and account B owns the VPC to be associated with the hosted zone.
Based on this, I suspect that the import
should be associated with a provider for the account that owns the VPC.
Thanks @acwwat for the references. Indeed, that's how those associations were created in the first place. However since these are import
blocks, I would expect that the authorization step is not required since the association already exists. The AWS CLI nor the Console provides no details as to what the foreign VPC account ID.
Yes, the authorization is just for illustration only (if you were to create everything in Terraform) and that probably don't need to be imported if already handled outside Terraform. What's more important is the the zone association should be imported in the context of account B, not account A. So you might need to supply a provider
argument for account B to the import
block, and have a separate aws_route53_zone_association
resource for the association that belong to account B.
@acwwat Great, thank you for the guidance. I'm going to mess around more with this and report back findings. I've already pulled the resources into different groups or organizational sanity purposes prior to filing this issue. Trying to correct the sins of pre-Terraform adoption, I figured it'd be good to do. This will be our first stack with multiple provider
definitions going across different accounts, so need to figure that out.
Hey @rwlodarczyk-xealth 👋 Were you able to test those changes to validate if it resolved the issue, or should this issue be kept open for further review?
Since we haven't heard back, I'm going to close this issue. If you're still having trouble, please feel free to open a new issue, referencing this one for context as needed.
[!WARNING] This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.
Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Terraform Core Version
1.5.7
AWS Provider Version
5.41.0
Affected Resource(s)
When trying to import in an existing VPC association using:
The following error is given:
Expected Behavior
This should import without issue.
Actual Behavior
The following error is given:
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
No