Skip to content

Commit 8bcda60

Browse files
Merge branch 'main' into add_tfe_organization_teams_data_source
2 parents becda40 + 46cce5a commit 8bcda60

File tree

6 files changed

+32
-5
lines changed

6 files changed

+32
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
steps:
3636
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
3737
- name: Set up Go
38-
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
38+
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
3939
with:
4040
go-version-file: go.mod
4141
cache: true

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
100100

101101
- name: Set up Go
102-
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
102+
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
103103
with:
104104
go-version-file: go.mod
105105
check-latest: true

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
## Unreleased
22

3-
* **New Data Source**: `d/tfe_teams` is a new data source to return names and IDs of Teams in an Organization, by @isaacmcollins [992] https://github.com/hashicorp/terraform-provider-tfe/pull/992
4-
3+
FEATURES:
4+
* `d/tfe_variable_set`: Add `project_ids` attribute, by @Netra2104 [994](https://github.com/hashicorp/terraform-provider-tfe/pull/994)
5+
* **New Data Source**: `d/tfe_teams` is a new data source to return names and IDs of Teams in an Organization, by @isaacmcollins [992](https://github.com/hashicorp/terraform-provider-tfe/pull/992)
56
## v0.48.0 (August 7, 2023)
67

78
BUG FIXES:

tfe/data_source_variable_set.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ func dataSourceTFEVariableSet() *schema.Resource {
4848
Computed: true,
4949
Elem: &schema.Schema{Type: schema.TypeString},
5050
},
51+
52+
"project_ids": {
53+
Type: schema.TypeSet,
54+
Optional: true,
55+
Computed: true,
56+
Elem: &schema.Schema{Type: schema.TypeString},
57+
},
5158
},
5259
}
5360
}
@@ -104,6 +111,12 @@ func dataSourceTFEVariableSetRead(d *schema.ResourceData, meta interface{}) erro
104111
}
105112
d.Set("variable_ids", variables)
106113

114+
var projects []interface{}
115+
for _, project := range vs.Projects {
116+
projects = append(projects, project.ID)
117+
}
118+
d.Set("project_ids", projects)
119+
107120
d.SetId(vs.ID)
108121
return nil
109122
}

tfe/data_source_variable_set_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ func TestAccTFEVariableSetsDataSource_full(t *testing.T) {
5656
"data.tfe_variable_set.foobar", "workspace_ids.#", "1"),
5757
resource.TestCheckResourceAttr(
5858
"data.tfe_variable_set.foobar", "variable_ids.#", "1"),
59+
resource.TestCheckResourceAttr(
60+
"data.tfe_variable_set.foobar", "project_ids.#", "1"),
5961
),
6062
},
6163
},
@@ -94,13 +96,23 @@ resource "tfe_workspace" "foobar" {
9496
organization = tfe_organization.foobar.id
9597
}
9698
99+
resource "tfe_project" "foobar" {
100+
name = "project-foo-%d"
101+
organization = tfe_organization.foobar.id
102+
}
103+
97104
resource "tfe_variable_set" "foobar" {
98105
name = "varset-foo-%d"
99106
description = "a description"
100107
organization = tfe_organization.foobar.id
101108
workspace_ids = [tfe_workspace.foobar.id]
102109
}
103110
111+
resource "tfe_project_variable_set" "foobar" {
112+
variable_set_id = tfe_variable_set.foobar.id
113+
project_id = tfe_project.foobar.id
114+
}
115+
104116
resource "tfe_variable" "envfoo" {
105117
key = "vfoo"
106118
value = "bar"
@@ -112,5 +124,5 @@ data "tfe_variable_set" "foobar" {
112124
name = tfe_variable_set.foobar.name
113125
organization = tfe_variable_set.foobar.organization
114126
depends_on = [tfe_variable.envfoo]
115-
}`, rInt, rInt, rInt)
127+
}`, rInt, rInt, rInt, rInt)
116128
}

website/docs/d/variable_set.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ The following arguments are supported:
3636
* `global` - Whether or not the variable set applies to all workspaces in the organization.
3737
* `workspace_ids` - IDs of the workspaces that use the variable set.
3838
* `variable_ids` - IDs of the variables attached to the variable set.
39+
* `project_ids` - IDs of the projects that use the variable set.

0 commit comments

Comments
 (0)