Skip to content

Conversation

@jar-b
Copy link
Member

@jar-b jar-b commented Dec 5, 2025

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Description

This will enable support for module-scoped User-Agent additions.

User-Agent details can be scoped to modules by setting provider_meta in the terraform block.

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 6.0"
    }
  }

  provider_meta "aws" {
    user_agent = [
      "example-demo/0.0.1 (a demo module)"
    ]
  }
}

Also,

  • Adds a user_agent provider argument for parity with the arguments available in the AWSCC provider.
  • Adds a user_agent provider-defined function to assist with composing entries for the user_agent argument from the constituent name, version, and comment parts.

Relations

Depends on hashicorp/aws-sdk-go-base#1389

Relates #45493
Relates hashicorp/terraform-provider-awscc#474

Output from Acceptance Testing

Plugin SDK V2 based resource:

% make t K=logs T=TestAccLogsLogGroup_providerMeta
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 f-provider-meta-simple 🌿...
TF_ACC=1 go1.24.11 test ./internal/service/logs/... -v -count 1 -parallel 20 -run='TestAccLogsLogGroup_providerMeta'  -timeout 360m -vet=off
2025/12/08 13:31:36 Creating Terraform AWS Provider (SDKv2-style)...
2025/12/08 13:31:36 Initializing Terraform AWS Provider (SDKv2-style)...

--- PASS: TestAccLogsLogGroup_providerMeta (14.83s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/logs       21.333s

Plugin Framework based resource:

% make t K=iot T=TestAccIoTBillingGroup_providerMeta
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 f-provider-meta-simple 🌿...
TF_ACC=1 go1.24.11 test ./internal/service/iot/... -v -count 1 -parallel 20 -run='TestAccIoTBillingGroup_providerMeta'  -timeout 360m -vet=off
2025/12/08 13:26:38 Creating Terraform AWS Provider (SDKv2-style)...
2025/12/08 13:26:38 Initializing Terraform AWS Provider (SDKv2-style)...

--- PASS: TestAccIoTBillingGroup_providerMeta (14.89s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/iot        21.397s
% TF_ACC=1 go test -v ./internal/function/... -run=TestUserAgentFunction_
2025/12/10 15:15:39 Creating Terraform AWS Provider (SDKv2-style)...
2025/12/10 15:15:39 Initializing Terraform AWS Provider (SDKv2-style)...

--- PASS: TestUserAgentFunction_invalid (1.32s)
--- PASS: TestUserAgentFunction_valid_name (7.90s)
--- PASS: TestUserAgentFunction_valid (7.93s)
--- PASS: TestUserAgentFunction_valid_nameVersion (7.98s)
--- PASS: TestUserAgentFunction_valid_nameComment (8.00s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/function   14.469s

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. provider Pertains to the provider itself, rather than any interaction with AWS. client-connections Pertains to the AWS Client and service connections. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. size/L Managed by automation to categorize the size of a PR. labels Dec 5, 2025
@jar-b jar-b force-pushed the f-provider-meta-simple branch from 61765df to 80f7a5f Compare December 5, 2025 21:10
jar-b added 3 commits December 8, 2025 13:34
This will enable support for module-scoped User-Agent additions. Also
introduces a `user_agent` provider argument for parity with the
arguments available in the AWSCC provider.

```terraform
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 6.0"
    }
  }

  provider_meta "aws" {
    user_agent = [
      "example-demo/0.0.1 (a demo module)"
    ]
  }
}
```
Plugin SDK V2 based resource:

```console
% make t K=logs T=TestAccLogsLogGroup_providerMeta
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 f-provider-meta-simple 🌿...
TF_ACC=1 go1.24.11 test ./internal/service/logs/... -v -count 1 -parallel 20 -run='TestAccLogsLogGroup_providerMeta'  -timeout 360m -vet=off
2025/12/08 13:31:36 Creating Terraform AWS Provider (SDKv2-style)...
2025/12/08 13:31:36 Initializing Terraform AWS Provider (SDKv2-style)...

--- PASS: TestAccLogsLogGroup_providerMeta (14.83s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/logs       21.333s
```

Plugin Framework based resource:

```console
% make t K=iot T=TestAccIoTBillingGroup_providerMeta
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 f-provider-meta-simple 🌿...
TF_ACC=1 go1.24.11 test ./internal/service/iot/... -v -count 1 -parallel 20 -run='TestAccIoTBillingGroup_providerMeta'  -timeout 360m -vet=off
2025/12/08 13:26:38 Creating Terraform AWS Provider (SDKv2-style)...
2025/12/08 13:26:38 Initializing Terraform AWS Provider (SDKv2-style)...

--- PASS: TestAccIoTBillingGroup_providerMeta (14.89s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/iot        21.397s
```
@jar-b jar-b force-pushed the f-provider-meta-simple branch from 80f7a5f to 1173735 Compare December 8, 2025 18:34
@github-actions github-actions bot added service/iot Issues and PRs that pertain to the iot service. service/logs Issues and PRs that pertain to the logs service. labels Dec 8, 2025
This function will format a User-Agent entry given a product name,
product version, and optional comment. It can be paired with the
`user_agent` argument in the `provider` and `provider_meta` blocks.

```console
% TF_ACC=1 go test -v ./internal/function/... -run=TestUserAgentFunction_
2025/12/10 15:06:44 Creating Terraform AWS Provider (SDKv2-style)...
2025/12/10 15:06:45 Initializing Terraform AWS Provider (SDKv2-style)...

--- PASS: TestUserAgentFunction_missingName (1.01s)
--- PASS: TestUserAgentFunction_basic (21.86s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/function   28.277s
```
@github-actions github-actions bot added function Pertains to provider functions. size/XL Managed by automation to categorize the size of a PR. labels Dec 10, 2025
```console
% TF_ACC=1 go test -v ./internal/function/... -run=TestUserAgentFunction_
2025/12/10 15:15:39 Creating Terraform AWS Provider (SDKv2-style)...
2025/12/10 15:15:39 Initializing Terraform AWS Provider (SDKv2-style)...

--- PASS: TestUserAgentFunction_invalid (1.32s)
--- PASS: TestUserAgentFunction_valid_name (7.90s)
--- PASS: TestUserAgentFunction_valid (7.93s)
--- PASS: TestUserAgentFunction_valid_nameVersion (7.98s)
--- PASS: TestUserAgentFunction_valid_nameComment (8.00s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/function   14.469s
```
@jar-b jar-b marked this pull request as ready for review December 11, 2025 15:57
@jar-b jar-b requested a review from a team as a code owner December 11, 2025 15:57
YakDriver
YakDriver previously approved these changes Dec 11, 2025
Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

This is pretty cool!

This brings together the provider-level and `provider_meta` module-scoped sections to provide a more complete picture of all the ways in which User-Agent headers can be extended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client-connections Pertains to the AWS Client and service connections. documentation Introduces or discusses updates to documentation. function Pertains to provider functions. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. provider Pertains to the provider itself, rather than any interaction with AWS. service/iot Issues and PRs that pertain to the iot service. service/logs Issues and PRs that pertain to the logs service. size/L Managed by automation to categorize the size of a PR. 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.

3 participants