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

r/codeartifact_repository - support external connection #15569

Conversation

DrFaust92
Copy link
Collaborator

@DrFaust92 DrFaust92 commented Oct 9, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #13714

Release note for CHANGELOG:

resource_aws_ codeartifact_repository - support external connections - Note that setting an external connection may replace any external connections created outside of terraform.
resource_aws_ codeartifact_repository - add plan time validation to `domain_owner`.

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSCodeArtifactRepository_'
--- PASS: TestAccAWSCodeArtifactRepository_disappears (52.49s)
--- PASS: TestAccAWSCodeArtifactRepository_basic (57.92s)
--- PASS: TestAccAWSCodeArtifactRepository_owner (57.98s)
--- PASS: TestAccAWSCodeArtifactRepository_description (94.39s)
--- PASS: TestAccAWSCodeArtifactRepository_externalConnection (136.09s)
--- PASS: TestAccAWSCodeArtifactRepository_upstreams (145.97s)

@DrFaust92 DrFaust92 requested a review from a team October 9, 2020 08:39
@ghost ghost added size/L Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/codeartifact Issues and PRs that pertain to the codeartifact service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Oct 9, 2020
@DrFaust92 DrFaust92 added the new-resource Introduces a new resource. label Oct 9, 2020
@ewbankkit
Copy link
Contributor

=== CONT  TestAccAWSCodeArtifactRepository_externalConnection
    resource_aws_codeartifact_repository_test.go:214: Step 3/4 error: Check failed: Check 2/2 error: aws_codeartifact_repository.test: Attribute 'external_connections.#' expected "0", got "1"
--- FAIL: TestAccAWSCodeArtifactRepository_externalConnection (50.75s)

With external_connections now Computed and Optional I think that the attribute will have to explicitly be set to an empty list to delete the connection:

  external_connections = []

In these cases we normally have something like

A configuration must be present for this argument to perform drift detection.

in the documentation for the attribute.

@DrFaust92
Copy link
Collaborator Author

@ewbankkit, TF doesn't like this config. its a config block rather than a list so I get errors for external_connections = [] or external_connections {}

I would opt to remove computed and add a comment that it may be destructive for external connections created out side of this resource. thoughts?

@ewbankkit
Copy link
Contributor

@DrFaust92 Yes, changing to non-Computed sounds like the best option here (with note in documentation).

@DrFaust92
Copy link
Collaborator Author

test is passing without computed. let me know if the wording in the docs is a bit weird. I couldn't think of a better way to phrase it.

@DrFaust92 DrFaust92 force-pushed the r/codeartifact_repository_external_connection branch from 0aaceb4 to 01196e6 Compare October 14, 2020 21:13
@ewbankkit
Copy link
Contributor

@DrFaust92 I suggest moving the Note that setting an external connection may replace any external connections created outside of terraform phrase to the release notes as this is the normal behavior for attributes and is just changing for this release.

Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM.

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSCodeArtifactRepository_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSCodeArtifactRepository_ -timeout 120m
=== RUN   TestAccAWSCodeArtifactRepository_basic
=== PAUSE TestAccAWSCodeArtifactRepository_basic
=== RUN   TestAccAWSCodeArtifactRepository_owner
=== PAUSE TestAccAWSCodeArtifactRepository_owner
=== RUN   TestAccAWSCodeArtifactRepository_description
=== PAUSE TestAccAWSCodeArtifactRepository_description
=== RUN   TestAccAWSCodeArtifactRepository_upstreams
=== PAUSE TestAccAWSCodeArtifactRepository_upstreams
=== RUN   TestAccAWSCodeArtifactRepository_externalConnection
=== PAUSE TestAccAWSCodeArtifactRepository_externalConnection
=== RUN   TestAccAWSCodeArtifactRepository_disappears
=== PAUSE TestAccAWSCodeArtifactRepository_disappears
=== CONT  TestAccAWSCodeArtifactRepository_basic
=== CONT  TestAccAWSCodeArtifactRepository_externalConnection
=== CONT  TestAccAWSCodeArtifactRepository_disappears
=== CONT  TestAccAWSCodeArtifactRepository_upstreams
=== CONT  TestAccAWSCodeArtifactRepository_description
=== CONT  TestAccAWSCodeArtifactRepository_owner
--- PASS: TestAccAWSCodeArtifactRepository_disappears (37.73s)
--- PASS: TestAccAWSCodeArtifactRepository_basic (41.39s)
--- PASS: TestAccAWSCodeArtifactRepository_owner (42.68s)
--- PASS: TestAccAWSCodeArtifactRepository_description (62.63s)
--- PASS: TestAccAWSCodeArtifactRepository_externalConnection (80.55s)
--- PASS: TestAccAWSCodeArtifactRepository_upstreams (83.17s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	83.220s

Co-authored-by: Kit Ewbank <Kit_Ewbank@hotmail.com>
@breathingdust
Copy link
Member

LGTM 🚀 Thanks @DrFaust92!

Verified Acceptance Tests in Commercial (us-west-2)

make testacc TEST=./aws TESTARGS='-run=TestAccAWSCodeArtifactRepository_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSCodeArtifactRepository_ -timeout 120m
=== RUN   TestAccAWSCodeArtifactRepository_basic
=== PAUSE TestAccAWSCodeArtifactRepository_basic
=== RUN   TestAccAWSCodeArtifactRepository_owner
=== PAUSE TestAccAWSCodeArtifactRepository_owner
=== RUN   TestAccAWSCodeArtifactRepository_description
=== PAUSE TestAccAWSCodeArtifactRepository_description
=== RUN   TestAccAWSCodeArtifactRepository_upstreams
=== PAUSE TestAccAWSCodeArtifactRepository_upstreams
=== RUN   TestAccAWSCodeArtifactRepository_externalConnection
=== PAUSE TestAccAWSCodeArtifactRepository_externalConnection
=== RUN   TestAccAWSCodeArtifactRepository_disappears
=== PAUSE TestAccAWSCodeArtifactRepository_disappears
=== CONT  TestAccAWSCodeArtifactRepository_basic
=== CONT  TestAccAWSCodeArtifactRepository_externalConnection
=== CONT  TestAccAWSCodeArtifactRepository_description
=== CONT  TestAccAWSCodeArtifactRepository_disappears
=== CONT  TestAccAWSCodeArtifactRepository_upstreams
=== CONT  TestAccAWSCodeArtifactRepository_owner
2020/10/21 14:14:57 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/10/21 14:14:57 [INFO] AWS Auth provider used: "SharedCredentialsProvider"
--- PASS: TestAccAWSCodeArtifactRepository_disappears (18.39s)
--- PASS: TestAccAWSCodeArtifactRepository_basic (20.70s)
--- PASS: TestAccAWSCodeArtifactRepository_owner (21.79s)
--- PASS: TestAccAWSCodeArtifactRepository_description (34.94s)
--- PASS: TestAccAWSCodeArtifactRepository_externalConnection (48.45s)
--- PASS: TestAccAWSCodeArtifactRepository_upstreams (48.86s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	50.654s

@breathingdust breathingdust added this to the v3.12.0 milestone Oct 21, 2020
@breathingdust breathingdust merged commit 7612423 into hashicorp:master Oct 21, 2020
breathingdust added a commit that referenced this pull request Oct 21, 2020
@ghost
Copy link

ghost commented Oct 22, 2020

This has been released in version 3.12.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 Nov 21, 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 as resolved and limited conversation to collaborators Nov 21, 2020
@DrFaust92 DrFaust92 deleted the r/codeartifact_repository_external_connection branch April 15, 2021 10:39
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. new-resource Introduces a new resource. service/codeartifact Issues and PRs that pertain to the codeartifact service. size/L 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.

Add AWS CodeArtifact service support
3 participants