Open gswallow opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
Bump for this; would be nice to see it get set to a null value so modules using this can ignore it.
data "aws_caller_identity" "me" {}
data "aws_iam_account_alias" "this_account" {}
module "foo" {
source = "..."
account_name = coalesce(
data.aws_iam_account_alias.this_account.account_alias,
data.aws_caller_identity.me.account_id,
)
}
Confirm this is still an issue with Terraform v1.5.7
and AWS provider v5.70.0
.
Terraform Core Version
1.1.5
AWS Provider Version
3.22.0
Affected Resource(s)
The aws_iam_account_alias data source, when operating in a brand new AWS account where the administrator has not set an IAM alias yet, returns an error: "no IAM account alias found."
Yet there is a default alias which matches the 12-digit account number of the AWS account.
Expected Behavior
Perhaps a reasonable alternative is to return the 12-digit account ID when an account alias does not exist?
Actual Behavior
Terraform plan fails.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
data "aws_iam_account_alias" "current" {}
Steps to Reproduce
run terraform plan in a new AWS account
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None