-
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
provider: Use real Terraform version in UA header #9570
Conversation
b3cfa86
to
9c6c7bd
Compare
7be4a6b
to
3d61671
Compare
3d61671
to
cfa7987
Compare
Hey @radeksimko 👋 I think this is looking okay -- can you please also fix the other usage of $ tf-sdk-migrator check
...
Checking whether provider uses deprecated SDK packages or identifiers...
Deprecated SDK packages in use: [github.com/hashicorp/terraform/flatmap]
Deprecated SDK identifiers in use: [Ident VersionString from package github.com/hashicorp/terraform/terraform is used at [/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/config.go:338:43 /Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_opsworks_stack.go:390:110]]
Some constraints not satisfied. Please resolve these before migrating to the new SDK. Thanks! |
Yeah, I was looking at it, but I wasn't sure what was the motivation there to have a separate resource-specific logic for handling sessions etc. - happy to look into it, although I hoped we could deal with it in a separate PR 😃 |
cfa7987
to
0e183c1
Compare
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 🚀 I will followup with the other session code.
Output from acceptance testing:
User-Agent: aws-sdk-go/1.24.4 (go1.13; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.12.7 (+https://www.terraform.io)
Output from Terraform 0.12.9 using updated provider binary:
User-Agent: aws-sdk-go/1.24.4 (go1.13; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.12.9 (+https://www.terraform.io)
Output from Terraform 0.11.14 using updated provider binary:
User-Agent: aws-sdk-go/1.24.4 (go1.13; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.11+compatible (+https://www.terraform.io)
… to real Terraform version Reference: hashicorp/terraform#13024 Reference: #9570 This migration is required for migrating to the standalone Terraform Plugin SDK and removing our dependency on github.com/hashicorp/terraform in the future. Output from acceptance testing: ``` --- PASS: TestAccAWSOpsWorksStack_classic_endpoints (28.89s) ``` User-Agent from testing above: ``` User-Agent: aws-sdk-go/1.24.4 (go1.13; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.12.7 ```
This has been released in version 2.30.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! |
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! |
The existing implementation leverages Terraform's
version
package as Terraform currently provides the SDK for interacting with core and is therefore imported by the provider, including theversion
package.The side effect of this is that provider reports version of vendored Terraform (i.e. plugin SDK), not the version which actually talks to the provider's gRPC server and parses the configuration.
This PR is leveraging recent changes introduced in 0.12 to fix that and report accurate version.
I also wanted to change the header from the following
to
to align it better with other providers.
The point of versioning of
HashiCorp
was (IMO rightfully) questioned during the implementation of hashicorp/terraform#22272 and the version was dropped from that helper function.However the upstream AWS SDK helpers used here for building the UA string may need to be tuned to reflect the RFC where version of products is optional. Dropping the
Version
part would otherwise producewhich is most likely undesired.
An example of a full UA string with this patch follows
I think it would be worth exploring ways of moving SDK/Go versions towards the end, to reflect RFC7231, specifically this part:
IMO Terraform is more significant in this context than the SDK - but I will leave that for another discussion/PR.