chore(provisioner/terraform): preserve existing AWS_SDK_UA_APP_ID (#24606) by DevelopmentCats · Pull Request #26474 · coder/coder · GitHub
Skip to content

chore(provisioner/terraform): preserve existing AWS_SDK_UA_APP_ID (#24606)#26474

Merged
matifali merged 1 commit into
backport/23138-to-2.29from
backport/24606-to-2.29
Jun 17, 2026
Merged

chore(provisioner/terraform): preserve existing AWS_SDK_UA_APP_ID (#24606)#26474
matifali merged 1 commit into
backport/23138-to-2.29from
backport/24606-to-2.29

Conversation

@DevelopmentCats

Copy link
Copy Markdown
Contributor

Backport of #24606 to release/2.29.

Original PR: #24606 — chore(provisioner/terraform): preserve existing AWS_SDK_UA_APP_ID
Merge commit: 9d28489
Requested by: @matifali (per Slack thread, ESR 2.29 included)

Stacking

2.29 is outside the auto-backport workflow's scope (latest 3 release branches), so this is cherry-picked manually. Because #24606 builds on #23138 (it replaces the literal AWS_SDK_UA_APP_ID=... line introduced there), this PR is stacked on top of #26473.

Once #26473 merges into release/2.29, please retarget this PR's base from backport/23138-to-2.29 to release/2.29.

The cherry-pick applied cleanly with no manual conflict resolution needed (provision.go auto-merged once #23138 was in place; safeenv.go and the new safeenv_internal_test.go had no overlap with 2.29).

go test -run 'TestProvision_SafeEnv|TestSafeEnvironValue|TestAWSSDKUserAgentEnv' ./provisioner/terraform/ passes locally.

Cherry-picked by Coder Agents on behalf of @DevelopmentCats.

…4606)

Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
Co-authored-by: Atif Ali <atif@coder.com>
(cherry picked from commit 9d28489)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Backports the Terraform provisioner change to preserve an operator’s pre-existing AWS_SDK_UA_APP_ID by appending Coder’s AWS PRM identifier (space-delimited per AWS guidance), instead of unconditionally overwriting it in the subprocess environment.

Changes:

  • Adds helpers/constants to compute an AWS_SDK_UA_APP_ID=... env entry based on inherited environment state.
  • Updates Terraform subprocess env construction to use the new logic instead of a hard-coded value.
  • Adds unit tests for the new helpers.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
provisioner/terraform/safeenv.go Adds safeEnvironValue and awsSDKUserAgentEnv to preserve/append AWS_SDK_UA_APP_ID.
provisioner/terraform/safeenv_internal_test.go Adds tests for the new helpers and append behavior.
provisioner/terraform/provision.go Switches from a hard-coded AWS UA env var to the helper-based value.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +59 to +67
func safeEnvironValue(env []string, name string) string {
prefix := name + "="
for _, e := range env {
if strings.HasPrefix(e, prefix) {
return strings.TrimPrefix(e, prefix)
}
}
return ""
}
Comment on lines +12 to +18
@matifali matifali merged commit 2c5a5cc into backport/23138-to-2.29 Jun 17, 2026
19 of 24 checks passed
@matifali matifali deleted the backport/24606-to-2.29 branch June 17, 2026 16:14
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.

3 participants