Skip to content

Commit 81c93cb

Browse files
authored
Merge branch 'main' into jfreda/add-team-notification-cfg-resource
2 parents ce8630a + 9990b80 commit 81c93cb

File tree

7 files changed

+60
-12
lines changed

7 files changed

+60
-12
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: lint
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
16+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1717
- uses: ./.github/actions/lint-provider-tfe
1818

1919
tests:
@@ -35,7 +35,7 @@ jobs:
3535
organization: hashicorp-v2
3636
workspace: tflocal-terraform-provider-tfe
3737

38-
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
38+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3939

4040
- uses: ./.github/actions/test-provider-tfe
4141
with:

.github/workflows/create-release-pr.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
outputs:
1818
version: ${{ steps.remove-leading-v.outputs.version }}
1919
steps:
20-
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2121

2222
- uses: actions-ecosystem/action-get-latest-tag@b7c32daec3395a9616f88548363a42652b22d435 # v1.6.0
2323
id: get-latest-tag
@@ -33,7 +33,7 @@ jobs:
3333
buildBinary:
3434
runs-on: ubuntu-latest
3535
steps:
36-
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
36+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3737
- name: Set up Go
3838
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
3939
with:
@@ -68,7 +68,7 @@ jobs:
6868
CHECKPOINT_DISABLE: "1"
6969
timeout-minutes: 120
7070
steps:
71-
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
71+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7272
- run: git config --global user.email "[email protected]"
7373
- run: git config --global user.name "Brandon Croft"
7474
- name: Get yarn cache directory path
@@ -102,7 +102,7 @@ jobs:
102102
TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins
103103

104104
- name: Create Pull Request
105-
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
105+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
106106
with:
107107
commit-message: "cdktf: update documentation"
108108
title: "release: ${{ github.event.inputs.version }}"

.github/workflows/mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout main
14-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
14+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1515

1616
- name: Deploy docs
1717
uses: mhausenblas/mkdocs-deploy-gh-pages@d77dd03172e96abbcdb081d8c948224762033653 # 1.26

.github/workflows/nightly-tfe-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
organization: hashicorp-v2
3737
workspace: tflocal-terraform-provider-tfe-nightly
3838

39-
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
39+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4040

4141
- uses: ./.github/actions/test-provider-tfe
4242
with:
@@ -96,7 +96,7 @@ jobs:
9696
needs: [tests-summarize]
9797
if: "${{ always() }}"
9898
steps:
99-
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
99+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
100100

101101
- name: Set up Go
102102
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
release-notes:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1616
with:
1717
fetch-depth: 0
1818
- name: Generate Release Notes

internal/provider/resource_tfe_workspace_settings.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (m validateSelfReference) PlanModifySet(_ context.Context, req planmodifier
179179
}
180180

181181
// Check if the workspace ID is in the set
182-
if slices.Contains(remoteStateConsumerIDs, workspaceID.ValueString()) {
182+
if !workspaceID.IsUnknown() && slices.Contains(remoteStateConsumerIDs, workspaceID.ValueString()) {
183183
resp.Diagnostics.AddError("Invalid remote_state_consumer_ids", "workspace_id cannot be in the set of remote_state_consumer_ids")
184184
}
185185
}

internal/provider/resource_tfe_workspace_settings_test.go

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,34 @@ func TestAccTFEWorkspaceSettings(t *testing.T) {
9595
})
9696
}
9797

98+
func TestAccTFEWorkspaceWithSettings(t *testing.T) {
99+
tfeClient, err := getClientUsingEnv()
100+
if err != nil {
101+
t.Fatal(err)
102+
}
103+
104+
org, cleanupOrg := createBusinessOrganization(t, tfeClient)
105+
t.Cleanup(cleanupOrg)
106+
107+
resource.Test(t, resource.TestCase{
108+
PreCheck: func() { testAccPreCheck(t) },
109+
ProtoV5ProviderFactories: testAccMuxedProviders,
110+
Steps: []resource.TestStep{
111+
// Start with local execution
112+
{
113+
Config: testAccTFEWorkspaceSettingsUnknownIDRemoteState(org.Name),
114+
Check: resource.ComposeTestCheckFunc(
115+
resource.TestCheckResourceAttrSet(
116+
"tfe_workspace_settings.foobar", "id"),
117+
resource.TestCheckResourceAttrSet(
118+
"tfe_workspace_settings.foobar", "workspace_id",
119+
),
120+
),
121+
},
122+
},
123+
})
124+
}
125+
98126
func TestAccTFEWorkspaceSettingsRemoteState(t *testing.T) {
99127
tfeClient, err := getClientUsingEnv()
100128
if err != nil {
@@ -222,7 +250,7 @@ func testAccCheckTFEWorkspaceSettingsDestroy(s *terraform.State) error {
222250
return testAccCheckTFEWorkspaceSettingsDestroyProvider(testAccProvider)(s)
223251
}
224252

225-
func testAccCheckTFEWorkspaceSettingsDestroyProvider(p *schema.Provider) func(s *terraform.State) error {
253+
func testAccCheckTFEWorkspaceSettingsDestroyProvider(_ *schema.Provider) func(s *terraform.State) error {
226254
return func(s *terraform.State) error {
227255
tfeClient, err := getClientUsingEnv()
228256
if err != nil {
@@ -256,6 +284,26 @@ func testAccCheckTFEWorkspaceSettingsDestroyProvider(p *schema.Provider) func(s
256284
}
257285
}
258286

287+
func testAccTFEWorkspaceSettingsUnknownIDRemoteState(orgName string) string {
288+
return fmt.Sprintf(`
289+
resource "tfe_workspace" "foobar1" {
290+
name = "foobar1"
291+
organization = "%s"
292+
}
293+
294+
resource "tfe_workspace" "foobar2" {
295+
name = "foobar2"
296+
organization = "%s"
297+
}
298+
299+
resource "tfe_workspace_settings" "foobar" {
300+
workspace_id = tfe_workspace.foobar1.id
301+
global_remote_state = false
302+
remote_state_consumer_ids = [tfe_workspace.foobar2.id]
303+
}
304+
`, orgName, orgName)
305+
}
306+
259307
func testAccTFEWorkspaceSettingsRemoteState(workspaceID, workspaceID2 string) string {
260308
return fmt.Sprintf(`
261309
resource "tfe_workspace_settings" "foobar" {

0 commit comments

Comments
 (0)