Terraform v0.12.3
provider.aws v2.26.0
provider "aws" {
region = "ap-southeast-2"
}
data "aws_ecr_repository" "main" {
name = "example/repo-name"
}
data "aws_iam_policy_document" "ecr_role_policy" {
statement {
actions = [
"ecr:*"
]
effect = "Allow"
resources = [
data.aws_ecr_repository.main.arn,
]
}
}
Error: Null value found in list
on main.tf line 15, in data "aws_iam_policy_document" "ecr_role_policy":
15: resources = [
16: data.aws_ecr_repository.main.arn,
17: ]
Null values are not allowed for this attribute value.
Terraform should display an error when the ECR cannot be found in the specified provider account.
The ARN resolves to Null and Terraform complains that null values are not allowed in the policy document resources attribute value.
terraform plan using the config aboveI can into this today- it also provides null output for the repository url instead of giving a proper error.
Hi folks 👋 The fix for this data source to properly return an error (https://github.com/terraform-providers/terraform-provider-aws/pull/10520) was recently merged and will release with version 3.0.0 of the Terraform AWS Provider, likely in about a week.
This has been released in version 3.0.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!
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!
Most helpful comment
Hi folks 👋 The fix for this data source to properly return an error (https://github.com/terraform-providers/terraform-provider-aws/pull/10520) was recently merged and will release with version 3.0.0 of the Terraform AWS Provider, likely in about a week.