Skip to content

Conversation

kelsi-hoyle
Copy link
Collaborator

@kelsi-hoyle kelsi-hoyle commented Jun 17, 2025

Description

At the time of GA for the Arm64 Agent Support project, the TFE Provider will need to support the creation and updating of tool versions with Linux amd64 and Linux arm64 architectures.

The tfe provider calls the Terraform versions API via go-tfe’s AdminTerraformVersionCreateOptions and AdminTerraformVersionUpdateOptions. To support the arm64 Terraform version creation and updates, the Archs field will need to be included in this request.

This change enables adds archs to the tool version resources to be added to the create and update calls and adds them to the read.

tfe_terraform_version, tfe_sentinel_version, and tfe_opa_version use the archs block:

archs [{
    url = "https://releases.hashicorp.com/terraform/..."
    sha = "dd68a600989c122c5e2ca9fd055f071bfbff8fa7047b48349489e4290b62b8c6"
    os = "linux"
    arch = "amd64"
  },
      {
        os = "linux"
        arch = "arm64"
        url = "https://releases.hashicorp.com/terraform/...."
        sha = "dd68a600989c122c5e2ca9fd055f071bfbff8fa7047b48349489e4290b62b8c9"
      }]

Remember to:

Screenshot 2025-07-07 at 11 41 21 AM

Testing plan

  1. Describe how to replicate
  2. the conditions
  3. under which your code performs its purpose,
  4. including example Terraform configs where necessary.

External links

Include any links here that might be helpful for people reviewing your PR. If there are none, feel free to delete this section.

Output from acceptance tests

Please run applicable acceptance tests locally and include the output here. See testing.md to learn how to run acceptance tests.

If you are an external contributor, your contribution(s) will first be reviewed before running them against the project's CI pipeline.

Screenshot 2025-08-04 at 3 53 38 PM Screenshot 2025-08-04 at 4 04 31 PM Screenshot 2025-08-04 at 4 05 19 PM

Rollback Plan

Changes to Security Controls

@kelsi-hoyle kelsi-hoyle force-pushed the kelsi-hoyle/TF-24744/arm-toolversion-support branch from cdf0756 to 8dc2594 Compare June 17, 2025 19:12
@kelsi-hoyle kelsi-hoyle changed the title Kelsi hoyle/tf 24744/arm toolversion support [TFDN-217] Add Support for Tool Version Architecture Fields Jun 17, 2025
@kelsi-hoyle
Copy link
Collaborator Author

One thing that I fond confusing is that if we send only archs, it updates the top level url and sha fields. This looks like they are being deleted in the diff with each change that does not have the url and sha.

Screenshot 2025-06-17 at 7 34 43 AM

@natalie-todd how willTFDN-843 effect this?

@natalie-todd
Copy link
Collaborator

One thing that I fond confusing is that if we send only archs, it updates the top level url and sha fields. This looks like they are being deleted in the diff with each change that does not have the url and sha.

Screenshot 2025-06-17 at 7 34 43 AM @natalie-todd how will[TFDN-843](https://hashicorp.atlassian.net/browse/TFDN-843) effect this?

TFDN-843 will make it so the top level url and sha are no longer being set.

@natalie-todd
Copy link
Collaborator

natalie-todd commented Jun 18, 2025

@kelsi-hoyle do you know what the release schedule is for the provider? We will need to know so we can time this with the TFE release. Let me know if it would be helpful for me to ask about this.

func testAccCheckTFEOPAVersionAttributesArchs(opaVersion *tfe.AdminOPAVersion, version string, sha string) resource.TestCheckFunc {
return func(s *terraform.State) error {
if opaVersion.Version != version {
return fmt.Errorf("Bad version: %s", opaVersion.Version)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this is happening in other parts of the repo too, but generally error strings are not capitalized. https://go.dev/wiki/CodeReviewComments#error-strings

@kelsi-hoyle kelsi-hoyle marked this pull request as ready for review June 19, 2025 14:00
@kelsi-hoyle kelsi-hoyle requested a review from a team as a code owner June 19, 2025 14:00
@kelsi-hoyle kelsi-hoyle requested a review from brandonc September 2, 2025 14:50
"deprecated_reason": schema.StringAttribute{
Optional: true,
},
"archs": schema.SetNestedAttribute{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

new archs functionality

Comment on lines +123 to +124
setplanmodifier.UseStateForUnknown(),
PreserveAMD64ArchsOnChange(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • UseStateForUnknown is needed to ensure that no refresh plans pass
  • Since these values can be computed and not always in the config, these plan modifiers are needed to ensure the values on update are correct.

Optional: true,
Default: nil,
},
"archs": schema.SetNestedAttribute{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

new archs functionality

"deprecated_reason": schema.StringAttribute{
Optional: true,
},
"archs": schema.SetNestedAttribute{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

new archs functionality

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