-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Amazon ECR Repository tags #6911
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great, thanks for all the awserr
and fmt.Errorf()
updates. Two little things and this will be good to go 😄
aws/resource_aws_ecr_repository.go
Outdated
d.Set("registry_id", repository.RegistryId) | ||
|
||
return resourceAwsEcrRepositoryRead(d, meta) | ||
return resourceAwsEcrRepositoryUpdate(d, meta) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update
after Create
usually winds up causing longterm maintenance issues with duplicate API calls, etc. due to lack of d.IsNewResource()
conditionals. Let's just copy the setTagsECR()
bits into Create
to prevent that problem in the future. 👍 (At some point we will likely have a provider linting tool that errors when calling Update
after Create
.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
// diffTags takes our tags locally and the ones remotely and returns | ||
// the set of tags that must be created, and the set of tags that must | ||
// be destroyed. | ||
func diffTagsECR(oldTags, newTags []*ecr.Tag) ([]*ecr.Tag, []*ecr.Tag) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot wait to make our own generic tag handling functions and type convert everything. 😅
) | ||
|
||
// go test -v -run="TestDiffECRTags" | ||
func TestDiffECRTags(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should check that we aren't submitting overlapping tags, see also:
The fix is:
Suggested changes made. $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSEcrRepository_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -parallel 20 -run=TestAccAWSEcrRepository_ -timeout 120m
=== RUN TestAccAWSEcrRepository_basic
=== PAUSE TestAccAWSEcrRepository_basic
=== RUN TestAccAWSEcrRepository_tags
=== PAUSE TestAccAWSEcrRepository_tags
=== CONT TestAccAWSEcrRepository_basic
=== CONT TestAccAWSEcrRepository_tags
--- PASS: TestAccAWSEcrRepository_basic (22.97s)
--- PASS: TestAccAWSEcrRepository_tags (35.08s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 53.557s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @ewbankkit! 🚀
AWS Commercial:
--- PASS: TestAccAWSEcrRepository_basic (4.41s)
--- PASS: TestAccAWSEcrDataSource_ecrRepository (5.09s)
--- PASS: TestAccAWSEcrRepository_tags (6.86s)
AWS GovCloud (US): (test failure known and unrelated)
--- FAIL: TestAccAWSEcrDataSource_ecrRepository (1.74s)
--- PASS: TestAccAWSEcrRepository_basic (1.76s)
--- PASS: TestAccAWSEcrRepository_tags (2.58s)
This has been released in version 1.53.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
Fixes #6896.
Acceptance tests: