Skip to content
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 is null for non-existant ECR loaded as data resource #9947

Closed
JonathanHolvey opened this issue Sep 2, 2019 · 4 comments
Closed
Labels
bug Addresses a defect in current functionality. service/ecr Issues and PRs that pertain to the ecr service. service/iam Issues and PRs that pertain to the iam service.
Milestone

Comments

@JonathanHolvey
Copy link

JonathanHolvey commented Sep 2, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.12.3
provider.aws v2.26.0

Affected Resource

  • aws_ecr_repository

Terraform Configuration Files

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,
    ]
  }
}

Debug output

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.

Expected Behaviour

Terraform should display an error when the ECR cannot be found in the specified provider account.

Actual Behaviour

The ARN resolves to Null and Terraform complains that null values are not allowed in the policy document resources attribute value.

Steps to Reproduce

  1. terraform plan using the config above
@ghost ghost added service/ecr Issues and PRs that pertain to the ecr service. service/iam Issues and PRs that pertain to the iam service. labels Sep 2, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 2, 2019
@tedivm
Copy link

tedivm commented Jul 23, 2020

I can into this today- it also provides null output for the repository url instead of giving a proper error.

@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 23, 2020
@bflad bflad added this to the v3.0.0 milestone Jul 23, 2020
@bflad
Copy link
Contributor

bflad commented Jul 23, 2020

Hi folks 👋 The fix for this data source to properly return an error (#10520) was recently merged and will release with version 3.0.0 of the Terraform AWS Provider, likely in about a week.

@bflad bflad closed this as completed Jul 23, 2020
@ghost
Copy link

ghost commented Jul 31, 2020

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!

@ghost
Copy link

ghost commented Aug 23, 2020

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!

@ghost ghost locked and limited conversation to collaborators Aug 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ecr Issues and PRs that pertain to the ecr service. service/iam Issues and PRs that pertain to the iam service.
Projects
None yet
Development

No branches or pull requests

3 participants