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

optionally specify additional user agent details #247

Merged
merged 7 commits into from
Nov 3, 2021

Conversation

jaymccon
Copy link
Contributor

@jaymccon jaymccon commented Oct 14, 2021

This PR enables Terraform configuration authors to optionally specify additional user-agent data that terraform passes on to AWS Cloud Control API's.

This is useful for discovery and compliance purposes, as the user-agent for each API call is available as a CloudTrail event. Teams can use this data to identify workloads running in their account such as 3rd party products, OU's, etc.

In addition to unit tests, functional tests were done by compiling the patched provider locally and running apply with TFLOG=TRACE set to print the raw api calls. Using this tf module:

provider "awscc" {
  region     = "us-east-1"
  user_agent = [
    {
      name    = "my-test-module"
      version = "0.0.1"
      comment = "testing user-agent comment" 
    }
  ]
}

resource "awscc_ec2_vpc" "test-vpc" {
  cidr_block = "10.0.0.0/16"
}

Checking both the Terraform trace output and the resulting event in CloudTrail I was able to confirm that the User-Agent had the custom data in addition to the default Terraform user-agent data:
APN/1.0 HashiCorp/1.0 Terraform/1.0.8 (+https://www.terraform.io) terraform-provider-awscc/dev (+https://registry.terraform.io/providers/hashicorp/awscc) my-test-module/0.0.1 (testing user-agent comment) aws-sdk-go-v2/1.9.1 os/macos lang/go/1.17 md/GOOS/darwin md/GOARCH/amd64 api/cloudcontrol/1.0.0

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
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

@ewbankkit ewbankkit requested a review from gdavison October 15, 2021 19:03
@gdavison gdavison self-assigned this Nov 3, 2021
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this PR, @jaymccon. I've updated the User-Agent handling code to append it to the User-Agent string instead of adding it to the APN info. I've also added documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants