-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARN attribute may contain incorrect AWS account ID for shareable resources #16978
Comments
|
|
|
|
|
|
|
|
The last one! 🎉 Thank you for your review, @ewbankkit! |
Hi @shuheiktgw! Thanks for all your work on this issue. 🚀 I've been trying to find your contact details, if you had a moment would you be able to email me at the address in my profile? Thank you! |
@breathingdust Sure! I just sent you an email so would you check your inbox? |
The final affected resource will be corrected with Terraform AWS Provider v3.35.0. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Terraform CLI and Terraform AWS Provider Version
AWS Provider v3.22.0.
Various resources (and data sources) for a number of AWS services include a computed
arn
resource that is synthesized in the resource'sRead
code rather than being set from relevant AWS API call's response (as the AWS API response does not include an ARN property). This page is a good starting point for finding the correct ARN format for such resources.For shareable resources the account ID should be the ID of the AWS account that owns the resource, however in many such cases we are incorrectly setting the account ID field to the ID of the AWS account that is running Terraform. While these two account IDs are equal for resources that are actually created, they will be different for data sources (and resources that adopt resources, such as
aws_default_route_table
) if Terraform is run in the AWS account that the resource is shared into I.e. NOT the account that the corresponding resource was created in and subsequently shared from).A typical incorrect pattern is
terraform-provider-aws/aws/data_source_aws_vpc.go
Lines 192 to 199 in 04e3b27
whereas a correct pattern is:
terraform-provider-aws/aws/data_source_aws_security_group.go
Lines 102 to 109 in 04e3b27
(apart from from the raw pointer dereference: #12992).
Affected Resource(s)
aws_ec2_capacity_reservation
owner_id
arn
- can be API responseaws_licensemanager_license_configuration
owner_account_id
arn
aws_ami
(and friends)owner_id
aws_vpc
/aws_default_vpc
arn
aws_ec2_carrier_gateway
arn
aws_vpc_dhcp_options
arn
aws_vpc_endpoint
arn
aws_internet_gateway
arn
aws_network_acl
/aws_default_network_acl
arn
aws_route_table
/aws_default_route_table
arn
aws_ec2_traffic_mirror_session
owner_id
arn
aws_ec2_traffic_mirror_target
owner_id
arn
Relates: #13624.
The text was updated successfully, but these errors were encountered: