Skip to content

Commit 53a3f84

Browse files
committed
Clarify parent_project_id vs. tfe_project_variable_set
1 parent 857ff6b commit 53a3f84

File tree

3 files changed

+65
-2
lines changed

3 files changed

+65
-2
lines changed

website/docs/r/project_variable_set.html.markdown

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ description: |-
77

88
# tfe_project_variable_set
99

10-
Adds and removes variable sets from a project
10+
Adds and removes a project from a variable set's scope.
11+
12+
-> **Note:** This resource controls whether a project has access to a variable set, not whether
13+
a project owns the variable set. Ownership is specified by setting the `parent_project_id` on the
14+
`tfe_variable_set` resource.
1115

1216
## Example Usage
1317

website/docs/r/variable_set.html.markdown

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,64 @@ resource "tfe_variable" "test-b" {
126126
}
127127
```
128128

129+
Creating a project-owned variable set that is applied to all workspaces in the project:
130+
131+
```hcl
132+
resource "tfe_organization" "test" {
133+
name = "my-org-name"
134+
135+
}
136+
137+
resource "tfe_project" "test" {
138+
organization = tfe_organization.test.name
139+
name = "projectname"
140+
}
141+
142+
resource "tfe_variable_set" "test" {
143+
name = "Project-owned Varset"
144+
description = "Varset that is owned and managed by a project."
145+
organization = tfe_organization.test.name
146+
parent_project_id = tfe_project.test.id
147+
}
148+
149+
resource "tfe_project_variable_set" "test" {
150+
project_id = tfe_project.test.id
151+
variable_set_id = tfe_variable_set.test.id
152+
}
153+
```
154+
155+
Creating a project-owned variable set that is applied to specific workspaces:
156+
157+
```hcl
158+
resource "tfe_organization" "test" {
159+
name = "my-org-name"
160+
161+
}
162+
163+
resource "tfe_project" "test" {
164+
organization = tfe_organization.test.name
165+
name = "projectname"
166+
}
167+
168+
resource "tfe_workspace" "test" {
169+
name = "my-workspace-name"
170+
organization = tfe_organization.test.name
171+
project_id = tfe_project.test.id
172+
}
173+
174+
resource "tfe_variable_set" "test" {
175+
name = "Project-owned Varset"
176+
description = "Varset that is owned and managed by a project."
177+
organization = tfe_organization.test.name
178+
parent_project_id = tfe_project.test.id
179+
}
180+
181+
resource "tfe_workspace_variable_set" "test" {
182+
workspace_id = tfe_workspace.test.id
183+
variable_set_id = tfe_variable_set.test.id
184+
}
185+
```
186+
129187
## Argument Reference
130188

131189
The following arguments are supported:
@@ -140,6 +198,7 @@ The following arguments are supported:
140198
[tfe_workspace_variable_set](workspace_variable_set.html) which is the preferred method of associating a workspace
141199
with a variable set.
142200
* `parent_project_id` - (Optional) ID of the project that should own the variable set. If set, than the value of `global` must be `false`.
201+
To assign whether a variable set should be applied to a project, use the [`tfe_project_variable_set`](project_variable_set.html) resource.
143202

144203
## Attributes Reference
145204

website/docs/r/workspace_variable_set.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: |-
77

88
# tfe_workspace_variable_set
99

10-
Adds and removes variable sets from a workspace
10+
Adds and removes a workspace from a variable set's scope.
1111

1212
-> **Note:** `tfe_variable_set` has a deprecated argument `workspace_ids` that should not be used alongside this resource. They attempt to manage the same attachments and are mutually exclusive.
1313

0 commit comments

Comments
 (0)