Skip to content

Commit 0a8a03f

Browse files
Removing create and update options for hyok_enabled. Updating test cases.
1 parent fb780a7 commit 0a8a03f

File tree

4 files changed

+4
-63
lines changed

4 files changed

+4
-63
lines changed

internal/provider/data_source_organization_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ func TestAccTFEOrganizationDataSource_readEnforceHYOK(t *testing.T) {
103103
Check: resource.ComposeAggregateTestCheckFunc(
104104
resource.TestCheckResourceAttr("data.tfe_organization.test", "name", orgName),
105105
resource.TestCheckResourceAttrSet("data.tfe_organization.test", "enforce_hyok"),
106-
resource.TestCheckResourceAttr("data.tfe_organization.test", "enforce_hyok", "true"),
107106
),
108107
},
109108
},

internal/provider/data_source_workspace_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ func TestAccTFEWorkspaceDataSource_readHYOKEnabled(t *testing.T) {
300300
resource.TestCheckResourceAttr("data.tfe_workspace.test", "organization", orgName),
301301
resource.TestCheckResourceAttr("data.tfe_workspace.test", "name", workspaceName),
302302
resource.TestCheckResourceAttrSet("data.tfe_workspace.test", "hyok_enabled"),
303-
resource.TestCheckResourceAttr("data.tfe_workspace.test", "hyok_enabled", "true"),
304303
),
305304
},
306305
},

internal/provider/resource_tfe_workspace.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,6 @@ func resourceTFEWorkspaceCreate(d *schema.ResourceData, meta interface{}) error
523523
options.Tags = append(options.Tags, &tfe.Tag{Name: name})
524524
}
525525

526-
if v, ok := d.GetOkExists("hyok_enabled"); ok {
527-
options.HYOKEnabled = tfe.Bool(v.(bool))
528-
}
529-
530526
log.Printf("[DEBUG] Create workspace %s for organization: %s", name, organization)
531527
workspace, err := config.Client.Workspaces.Create(ctx, organization, options)
532528
if err != nil {
@@ -760,12 +756,6 @@ func resourceTFEWorkspaceUpdate(d *schema.ResourceData, meta interface{}) error
760756
}
761757
}
762758

763-
if d.HasChange("hyok_enabled") {
764-
if v, ok := d.GetOkExists("enforce_hyok"); ok {
765-
options.HYOKEnabled = tfe.Bool(v.(bool))
766-
}
767-
}
768-
769759
// NOTE: since agent_pool_id and execution_mode are both deprecated on
770760
// tfe_workspace and we want tfe_workspace_settings to be authoritative,
771761
// we must not set the overwrites values to false in the checks below.

internal/provider/resource_tfe_workspace_test.go

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,65 +2955,19 @@ func TestAccTFEWorkspace_HYOKEnabled(t *testing.T) {
29552955
t.Skip("HYOK_ORGANIZATION_NAME environment variable must be set to run this test")
29562956
}
29572957

2958-
// Testing workspace hyok enabled going from false to true.
29592958
resource.Test(t, resource.TestCase{
29602959
PreCheck: func() { testAccPreCheck(t) },
29612960
ProtoV6ProviderFactories: testAccMuxedProviders,
29622961
CheckDestroy: testAccCheckTFEWorkspaceDestroy,
29632962
Steps: []resource.TestStep{
2964-
// Create workspace with hyok_enabled set to false
29652963
{
2966-
Config: testAccTFEWorkspaceHYOKEnabledConfig(orgName, false),
2964+
Config: testAccTFEWorkspaceConfig(orgName),
29672965
Check: resource.ComposeAggregateTestCheckFunc(
29682966
resource.TestCheckResourceAttr("tfe_workspace.foobar", "organization", orgName),
2967+
resource.TestCheckResourceAttrSet("tfe_workspace.foobar", "hyok_enabled"),
29692968
resource.TestCheckResourceAttr("tfe_workspace.foobar", "hyok_enabled", "false"),
29702969
),
29712970
},
2972-
// Import
2973-
{
2974-
ResourceName: "tfe_workspace.foobar",
2975-
ImportState: true,
2976-
ImportStateVerify: true,
2977-
},
2978-
// Update hyok_enabled to true
2979-
{
2980-
Config: testAccTFEWorkspaceHYOKEnabledConfig(orgName, true),
2981-
Check: resource.ComposeAggregateTestCheckFunc(
2982-
resource.TestCheckResourceAttr("tfe_workspace.foobar", "organization", orgName),
2983-
resource.TestCheckResourceAttr("tfe_workspace.foobar", "hyok_enabled", "true"),
2984-
),
2985-
},
2986-
},
2987-
})
2988-
2989-
// Testing workspace hyok enabled going from true to false.
2990-
resource.Test(t, resource.TestCase{
2991-
PreCheck: func() { testAccPreCheck(t) },
2992-
ProtoV6ProviderFactories: testAccMuxedProviders,
2993-
CheckDestroy: testAccCheckTFEWorkspaceDestroy,
2994-
Steps: []resource.TestStep{
2995-
// Create workspace with hyok_enabled set to true
2996-
{
2997-
Config: testAccTFEWorkspaceHYOKEnabledConfig(orgName, true),
2998-
Check: resource.ComposeAggregateTestCheckFunc(
2999-
resource.TestCheckResourceAttr("tfe_workspace.foobar", "organization", orgName),
3000-
resource.TestCheckResourceAttr("tfe_workspace.foobar", "hyok_enabled", "true"),
3001-
),
3002-
},
3003-
// Import
3004-
{
3005-
ResourceName: "tfe_workspace.foobar",
3006-
ImportState: true,
3007-
ImportStateVerify: true,
3008-
},
3009-
// Update hyok_enabled to false, however hyok_enabled cannot be disabled once enabled.
3010-
{
3011-
Config: testAccTFEWorkspaceHYOKEnabledConfig(orgName, false),
3012-
Check: resource.ComposeAggregateTestCheckFunc(
3013-
resource.TestCheckResourceAttr("tfe_workspace.foobar", "organization", orgName),
3014-
resource.TestCheckResourceAttr("tfe_workspace.foobar", "hyok_enabled", "true"),
3015-
),
3016-
},
30172971
},
30182972
})
30192973
}
@@ -4228,12 +4182,11 @@ resource "tfe_workspace" "foobar" {
42284182
}`, rInt)
42294183
}
42304184

4231-
func testAccTFEWorkspaceHYOKEnabledConfig(orgName string, hyokEnabled bool) string {
4185+
func testAccTFEWorkspaceConfig(orgName string) string {
42324186
return fmt.Sprintf(`
42334187
resource "tfe_workspace" "foobar" {
42344188
organization = "%s"
42354189
name = "tfe-provider-test-workspace-hyok-enabled"
4236-
hyok_enabled = %t
42374190
}
4238-
`, orgName, hyokEnabled)
4191+
`, orgName)
42394192
}

0 commit comments

Comments
 (0)