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

Fixes older TFE, tfe_workspace_settings always unsets execution_mode #1193

Merged
merged 3 commits into from
Dec 22, 2023

Conversation

brandonc
Copy link
Collaborator

@brandonc brandonc commented Dec 22, 2023

Description

I made a mistake with tfe_workspace_settings compatibility. The "unknownIfExecutionModeUnset" plan modifier was supposed to actually check for unsetting before changing the planned value of execution_mode when it had no overwrites to consult.

Tested on TFC and TFE v202308-1

Remember to:

Testing plan

  1. Use this config. Run terraform apply twice. It works fine on the last couple of TFE releases (this is why there are no acceptance tests) but on v202308-1 the second plan fails
Sample Config
terraform {
  required_providers {
    tfe = {
      source = "hashicorp/tfe"
      version = "0.51.0"
    }
  }
}

provider "tfe" {
}

resource tfe_organization "org" {
  name = "test-IPL5516-tfe"
  email = "[email protected]"
}

// 1
resource "tfe_agent_pool" "pool" {
  name         = "pool"
  organization = tfe_organization.org.id
  organization_scoped = false
}

// 2
resource "tfe_workspace" "test" {
  name         = "test-123360"
  organization = tfe_organization.org.id
}

// 3
resource "tfe_agent_pool_allowed_workspaces" "pool" {
  agent_pool_id = tfe_agent_pool.pool.id
  allowed_workspace_ids = [for key, value in tfe_workspace.test.*.id : value]
}

// 4
resource "tfe_workspace_settings" "test-settings" {
  execution_mode = "agent"
  agent_pool_id = tfe_agent_pool_allowed_workspaces.pool.agent_pool_id
  workspace_id   = tfe_workspace.test.id
}

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.

@brandonc brandonc requested a review from a team as a code owner December 22, 2023 18:19
@brandonc brandonc force-pushed the brandonc/IPL-5516-tfe_compatibility branch from 824e80a to e006191 Compare December 22, 2023 18:23
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Sebastian Rivera <[email protected]>
@brandonc brandonc merged commit bbae4b8 into main Dec 22, 2023
9 checks passed
@brandonc brandonc deleted the brandonc/IPL-5516-tfe_compatibility branch December 22, 2023 20:37
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