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

backend/s3: Switch from github.com/terraform-providers/terraform-provider-aws to github.com/hashicorp/aws-sdk-go-base #20374

Merged
merged 3 commits into from
Feb 20, 2019

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Feb 18, 2019

Output from acceptance testing (no new failures):

--- PASS: TestBackend_impl (0.00s)
--- PASS: TestBackendConfig (0.37s)
--- PASS: TestBackendConfig_invalidKey (0.00s)
--- PASS: TestBackend (3.26s)
--- PASS: TestBackendLocked (6.80s)
--- FAIL: TestBackendExtraPaths (2.32s)
--- PASS: TestBackendPrefixInWorkspace (2.06s)
--- PASS: TestKeyEnv (8.20s)
--- PASS: TestRemoteClient_impl (0.00s)
--- PASS: TestRemoteClient (2.42s)
--- PASS: TestRemoteClientLocks (6.33s)
--- PASS: TestForceUnlock (13.31s)
--- PASS: TestRemoteClient_clientMD5 (11.75s)
--- PASS: TestRemoteClient_stateChecksum (10.07s)

…ider-aws to github.com/hashicorp/aws-sdk-go-base

Output from acceptance testing (no new failures):

```
--- PASS: TestBackend_impl (0.00s)
--- PASS: TestBackendConfig (0.37s)
--- PASS: TestBackendConfig_invalidKey (0.00s)
--- PASS: TestBackend (3.26s)
--- PASS: TestBackendLocked (6.80s)
--- FAIL: TestBackendExtraPaths (2.32s)
--- PASS: TestBackendPrefixInWorkspace (2.06s)
--- PASS: TestKeyEnv (8.20s)
--- PASS: TestRemoteClient_impl (0.00s)
--- PASS: TestRemoteClient (2.42s)
--- PASS: TestRemoteClientLocks (6.33s)
--- PASS: TestForceUnlock (13.31s)
--- PASS: TestRemoteClient_clientMD5 (11.75s)
--- PASS: TestRemoteClient_stateChecksum (10.07s)
```
@bflad bflad requested review from a team February 18, 2019 07:36
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

screen shot 2019-02-18 at 08 01 43

💯 🎉

This overall looks good and I'm so thankful for this PR!
My only real concern/question is about the deprecations.

@@ -155,20 +155,23 @@ func New() backend.Backend {
Optional: true,
Description: "Skip getting the supported EC2 platforms.",
Default: false,
Deprecated: "This attribute is no longer used.",
Copy link
Member

Choose a reason for hiding this comment

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

Is there any more context to this? e.g. why are we deprecating this and what do we expect users which used this in the past to do? As far as I remember this also had some performance background.

Regardless: Do we need to introduce deprecations as part of this PR which is swapping a library?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes. 😄 The reason for the deprecation is that for the S3 Backend this EC2 service functionality is not needed since we are only interfacing with the S3 service and potentially the DynamoDB service. When I split off the new shared library, I specifically omitted it from the library since only the Terraform AWS Provider actually needs it. The Terraform AWS Provider will continue to utilize the functionality and provide that configuration option.

Copy link
Member

Choose a reason for hiding this comment

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

👌Removing skip_get_ec2_platforms makes sense. I'd just add the explanation there right to the deprecation message, so it's clear.

I'm not sure about the other two though:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

skip_region_validation - this provider still uses region which may get validated?

The utility of the region validation check is questionable, in my opinion. There are valid cases where the validation gets in the way:

  • AWS turns on new region in Standard/GovCloud/China partition: Operators have to wait for a Terraform release with updated AWS Go SDK that captures the updated region and know to implement the workaround in the meantime. This happened recently with eu-north-1.
  • AWS has valid regions outside Standard/GovCloud/China partitions (e.g. AWS Secret and AWS Top Secret partitions) which are not captured by the default region validation.

I'm not heavily opposed to adding the check into the new library and still validating it with the S3 Backend though.

Previously requesting account ID did nothing useful for the S3 Backend beyond additional IAM/STS API calls which could fail, so the removal of the account ID logic from the S3 Backend provides adds stability.

In the context of the feature request mentioned and this argument, enabling the skip_requesting_account_id argument and either of the new allowed_account_ids/forbidden_account_ids arguments seems like they would represent a conflicting configuration that should error. Rather than potentially having conflicting arguments, it seems like we can tune that pull request functionality to only do the account ID lookup when the new arguments are defined.

I think this represents a useful split in functionality from the Terraform AWS Provider, where the Terraform AWS Provider actually requires the account ID lookup for various manual ARN construction, while the S3 Backend would only need it in the context of optionally validating the account ID itself.

Copy link
Member

Choose a reason for hiding this comment

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

Re skip_region_validation

Thanks a lot for describing the background here. It sounds like keeping this option would allow folks to use (and keep using) new and secret regions, which I think is desirable? In other words it is desirable that we keep the option for these people?

I don't have too strong opinion about this one though and block the PR on it, but I'd be more inclined to keep this one.

Rather than potentially having conflicting arguments, it seems like we can tune that pull request functionality to only do the account ID lookup when the new arguments are defined.

That's a great idea 👍 Feel free to deprecate it then.

@@ -216,8 +200,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kubernetes-sigs/aws-iam-authenticator v0.3.1-0.20181019024009-82544ec86140 h1:AtXWrgewhHlLux0IAfHINCbkxkf47euklyallWlximw=
github.com/kubernetes-sigs/aws-iam-authenticator v0.3.1-0.20181019024009-82544ec86140/go.mod h1:ItxiN33Ho7Di8wiC4S4XqbH1NLF0DNdDWOd/5MI9gJU=
Copy link
Member

Choose a reason for hiding this comment

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

I'm sure this will make @alexsomesan happy 😄

Copy link
Member

Choose a reason for hiding this comment

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

Overall this PR makes me happy. Thank a ton, @bflad !
Also, you were super fast!

github.com/terraform-providers/terraform-provider-template v1.0.0/go.mod h1:/J+B8me5DCMa0rEBH5ic2aKPjhtpWNeScmxFJWxB1EU=
github.com/terraform-providers/terraform-provider-tls v0.1.0/go.mod h1:Mxe/v5u31LDW4m32O1z6Ursdh95dpc9Puq6otkYg7tU=
github.com/terraform-providers/terraform-provider-tls v1.2.0 h1:wcD0InKzNh8fanUYQwim62WCd4toeD9WJnPw/RjBI4o=
github.com/terraform-providers/terraform-provider-tls v1.2.0/go.mod h1:Mxe/v5u31LDW4m32O1z6Ursdh95dpc9Puq6otkYg7tU=
Copy link
Member

Choose a reason for hiding this comment

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

ji7wlon

@bflad
Copy link
Contributor Author

bflad commented Feb 19, 2019

Please let me know if you have any additional questions/concerns/changes! 👍

},

"skip_requesting_account_id": {
Type: schema.TypeBool,
Optional: true,
Description: "Skip requesting the account ID.",
Default: false,
Deprecated: "The S3 Backend no longer automatically uses IAM or STS functionality to lookup the AWS Account ID and this attribute is no longer used.",
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: IAM or STS are mostly implementation details, so we could just say "The S3 Backend no longer looks up the AWS Account ID and this attribute is no longer used." ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem will update tomorrow 👍

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

@bflad I will leave the decision about skip_region_validation on you. If you do however decide to deprecate it, I think it should come with a reason in the deprecation message which answers the "why" question and ideally "what do I do now" question. 😉

Thanks again for all your efforts that went into this PR and the relevant library. 🎉 🚀

@bflad
Copy link
Contributor Author

bflad commented Feb 20, 2019

I will pull in the validation functions and keep the region checking for now. Updates tomorrow morning will be updating the copy on the account ID deprecation, updating the vendoring to include the validation functions, and add the region check back into the backend.

Thanks so much for your detailed reviews!

@bflad bflad added this to the v0.12.0 milestone Feb 20, 2019
@bflad
Copy link
Contributor Author

bflad commented Feb 20, 2019

Everything passes as it did previously, merging!

--- PASS: TestBackend_impl (0.00s)
--- PASS: TestBackendConfig (0.39s)
--- PASS: TestBackendConfig_invalidKey (0.00s)
--- PASS: TestBackend (2.83s)
--- PASS: TestBackendLocked (9.76s)
--- FAIL: TestBackendExtraPaths (2.47s)
--- PASS: TestBackendPrefixInWorkspace (2.39s)
--- PASS: TestKeyEnv (8.57s)
--- PASS: TestRemoteClient_impl (0.00s)
--- PASS: TestRemoteClient (1.77s)
--- PASS: TestRemoteClientLocks (9.26s)
--- PASS: TestForceUnlock (9.69s)
--- PASS: TestRemoteClient_clientMD5 (8.64s)
--- PASS: TestRemoteClient_stateChecksum (9.95s)

@bflad bflad merged commit 185a330 into master Feb 20, 2019
@bflad bflad deleted the td-backend-s3-dependencies branch February 20, 2019 16:42
bflad added a commit that referenced this pull request Feb 20, 2019
bflad added a commit to hashicorp/terraform-provider-aws that referenced this pull request Feb 22, 2019
…ent instantiation

The new library was split off from this repository to improve dependency management upstream in Terraform core. See also: hashicorp/terraform#20374
bflad added a commit to hashicorp/terraform-provider-aws that referenced this pull request Feb 26, 2019
…ent instantiation

The new library was split off from this repository to improve dependency management upstream in Terraform core. See also: hashicorp/terraform#20374
bflad added a commit that referenced this pull request Mar 12, 2019
…ider-aws to github.com/hashicorp/aws-sdk-go-base

References:

* #20374
* #20338
* #19992

Backports the S3 backend code from master to v0.11 relating to the AWS Go SDK, which removes the circular dependency with the Terraform AWS Provider and adds retry logic to the backend to prevent temporary networking or AWS service issues from failing unnecessarily.

Updated via code change then:

```
go mod tidy
go mod vendor
```
apparentlymart pushed a commit that referenced this pull request May 7, 2019
…ider-aws to github.com/hashicorp/aws-sdk-go-base

References:

* #20374
* #20338
* #19992

Backports the S3 backend code from master to v0.11 relating to the AWS Go SDK, which removes the circular dependency with the Terraform AWS Provider and adds retry logic to the backend to prevent temporary networking or AWS service issues from failing unnecessarily.

Updated via code change then:

```
go mod tidy
go mod vendor
```
@ghost
Copy link

ghost commented Mar 29, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants