atmos icon indicating copy to clipboard operation
atmos copied to clipboard

Set custom user agent for Terraform providers

Open Cerebrovinny opened this issue 1 year ago β€’ 3 comments

what

  • Atmos command should now set TF_APPEND_USER_AGENT environment variable which terraform will use when interacting with AWS provider.

why

  • Customer user agent is missing for Terraform, it will helps differentiate atmos driven actions from others, with this change users should be able to identify and monitor operations initiated by atmos.

testing listing s3 buckets and log output in cloudtrial CleanShot 2024-10-20 at 09 35 34

references

#DEV-2337

Summary by CodeRabbit

  • New Features

    • Introduced a new AppendUserAgent field in Terraform configurations, allowing users to specify a user agent string for enhanced metadata.
    • Updated the logic for the terraform deploy command to improve command handling and environment variable management.
  • Bug Fixes

    • Enhanced handling of the auto-approve flag based on user input and configuration settings.

Cerebrovinny avatar Oct 19 '24 16:10 Cerebrovinny

[!WARNING]

Rate limit exceeded

@aknysh has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 51 seconds before requesting another review.

βŒ› How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

πŸ“₯ Commits

Files that changed from the base of the PR and between 455f9d8d08a8bb3ef0b16a8921ea3a1b1ed3a9de and 2bf45dcdaf417d111785dcbf60214f3f7fd922bd.

πŸ“ Walkthrough
πŸ“ Walkthrough
πŸ“ Walkthrough
πŸ“ Walkthrough
πŸ“ Walkthrough

Walkthrough

The changes in this pull request primarily focus on enhancing the handling of user agent strings within the Atmos CLI, specifically for Terraform commands. Modifications include the introduction of new fields and flags for user agent management, updates to configuration files, and documentation enhancements to clarify these new features. The changes also involve a shift in how version information is managed across various files, reflecting a restructuring of the codebase.

Changes

File Change Summary
internal/exec/terraform.go Modified ExecuteTerraform to manage TF_APPEND_USER_AGENT, updated handling for terraform deploy.
pkg/schema/schema.go Added AppendUserAgent field to Terraform and ArgsAndFlagsInfo structs.
pkg/config/config.go Added AppendUserAgent field to defaultCliConfig, updated InitCliConfig for user agent initialization.
pkg/config/utils.go Introduced handling for ATMOS_COMPONENTS_TERRAFORM_APPEND_USER_AGENT environment variable.
.goreleaser.yml Updated ldflags to change version flag import path.
Makefile Updated ldflags in the build target to change version variable path.
build.sh Modified go build command to update version variable path.
cmd/version.go Removed hardcoded version variable, replaced with dynamic import from version package.
internal/exec/utils.go Added cfg.AppendUserAgentFlag for command-line flag processing, updated info.AppendUserAgent.
pkg/config/const.go Added constant AppendUserAgentFlag for command-line usage.
pkg/version/version.go Introduced new version package with a dynamic Version variable.
website/docs/quick-start/install-atmos.mdx Updated installation instructions to reflect new version variable path.
internal/exec/help.go Added help message for the --append-user-agent flag.
website/src/components/Screengrabs/atmos-terraform--help.html Updated help documentation for atmos command with new flag details.
website/docs/cli/commands/terraform/usage.mdx Updated atmos terraform command documentation with new flags and features.
website/docs/core-concepts/projects/configuration/terraform.mdx Added append_user_agent configuration option to Terraform settings in YAML.

Possibly related PRs

  • #549: The changes in this PR enhance the installation instructions, which may indirectly relate to the user experience improvements from the main PR's updates to the ExecuteTerraform function and environment variable handling.
  • #720: This PR adds a guide for installing Atmos using aqua, which is relevant as it provides users with additional methods to set up the environment that could utilize the new features introduced in the main PR.
  • #724: This PR modifies the help command behavior, which is directly related to the user experience improvements in the main PR, particularly regarding how commands are processed and displayed to users.

Suggested labels

minor

Suggested reviewers

  • osterman
  • aknysh
  • hans-d
  • joe-niland

Poem

In the garden of code, a new flag does bloom,
--append-user-agent, dispelling the gloom.
With user agents now set, our requests take flight,
In the world of Terraform, everything feels right.
So hop along, friends, let’s build and deploy,
With Atmos in hand, we’ll code with great joy! πŸ‡βœ¨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❀️ Share
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Oct 19 '24 16:10 coderabbitai[bot]

I guess we should move the static version to dynamic using AppendUserAgent: fmt.Sprintf("Cloud Posse Atmos %s (https://atmos.tools)", AtmosVersion),

Cerebrovinny avatar Oct 20 '24 17:10 Cerebrovinny

@Cerebrovinny thanks for the screenshot. Looks like we're not following the general UA convention.

Let's change to: Atmos/1.181 (Cloud Posse; +https://atmos.tools)

For reference, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent

osterman avatar Oct 21 '24 01:10 osterman

These changes were released in v1.96.0.

github-actions[bot] avatar Oct 29 '24 05:10 github-actions[bot]