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

Amazon ECR Repository tags #6911

Merged
merged 2 commits into from
Dec 18, 2018
Merged

Amazon ECR Repository tags #6911

merged 2 commits into from
Dec 18, 2018

Conversation

ewbankkit
Copy link
Contributor

Fixes #6896.

Acceptance tests:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSEcrDataSource_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -parallel 20 -run=TestAccAWSEcrDataSource_ -timeout 120m
=== RUN   TestAccAWSEcrDataSource_ecrRepository
=== PAUSE TestAccAWSEcrDataSource_ecrRepository
=== CONT  TestAccAWSEcrDataSource_ecrRepository
--- PASS: TestAccAWSEcrDataSource_ecrRepository (25.30s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	44.473s
$ 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 (20.98s)
--- PASS: TestAccAWSEcrRepository_tags (33.17s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	54.343s

@ghost ghost added size/XL Managed by automation to categorize the size of a PR. service/ecr Issues and PRs that pertain to the ecr service. service/elasticache Issues and PRs that pertain to the elasticache service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. labels Dec 18, 2018
Copy link
Contributor

@bflad bflad left a 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 😄

d.Set("registry_id", repository.RegistryId)

return resourceAwsEcrRepositoryRead(d, meta)
return resourceAwsEcrRepositoryUpdate(d, meta)
Copy link
Contributor

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.)

Copy link
Contributor Author

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) {
Copy link
Contributor

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Dec 18, 2018
@ewbankkit
Copy link
Contributor Author

Suggested changes made.
Re-ran acceptance tests:

$ 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

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Dec 18, 2018
@bflad bflad added this to the v1.53.0 milestone Dec 18, 2018
Copy link
Contributor

@bflad bflad left a 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)

@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Dec 18, 2018
@bflad bflad merged commit 660ccf1 into hashicorp:master Dec 18, 2018
bflad added a commit that referenced this pull request Dec 18, 2018
@ewbankkit ewbankkit deleted the issue-6896 branch December 19, 2018 12:03
@bflad
Copy link
Contributor

bflad commented Dec 20, 2018

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.

@ghost
Copy link

ghost commented Apr 1, 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 Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/ecr Issues and PRs that pertain to the ecr service. service/elasticache Issues and PRs that pertain to the elasticache service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Amazon ECR Repository tags
2 participants