-
Notifications
You must be signed in to change notification settings - Fork 159
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
Add support for project-owned variable sets #1522
Conversation
df28184
to
335e479
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Looks terrific! Would you mind adding some documentation to the project_variable_set
resource as well so we can alleviate any potential confusion between the resources? We should also add a note here about the difference between this parent_project_id
and project_variable_set
.
@@ -168,7 +197,7 @@ func resourceTFEVariableSetUpdate(d *schema.ResourceData, meta interface{}) erro | |||
log.Printf("[DEBUG] Update variable set: %s", d.Id()) | |||
_, err := config.Client.VariableSets.Update(ctx, d.Id(), &options) | |||
if err != nil { | |||
return fmt.Errorf("Error updateing variable %s: %w", d.Id(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
@@ -7,7 +7,7 @@ description: |- | |||
|
|||
# tfe_workspace_variable_set | |||
|
|||
Adds and removes variable sets from a workspace | |||
Adds and removes a workspace from a variable set's scope. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed for consistency with tfe_project_variable_set
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, especially because making it consistent on the project side to read "Adds and removes variable sets from a project" could be ambiguous.
@@ -126,6 +126,64 @@ resource "tfe_variable" "test-b" { | |||
} | |||
``` | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if adding both makes the example section too long, but I thought it would be valuable to make it clear that a project-owned varset doesn't necessarily/automatically apply itself to the project and that it can be scoped to workspaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely, great idea to make that behavior clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for the great examples.
@@ -126,6 +126,64 @@ resource "tfe_variable" "test-b" { | |||
} | |||
``` | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely, great idea to make that behavior clear.
@@ -7,7 +7,7 @@ description: |- | |||
|
|||
# tfe_workspace_variable_set | |||
|
|||
Adds and removes variable sets from a workspace | |||
Adds and removes a workspace from a variable set's scope. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, especially because making it consistent on the project side to read "Adds and removes variable sets from a project" could be ambiguous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
This new attribute specifies that the varset is owned by the given project.
a915196
to
53a3f84
Compare
Rebased to fix merge conflict with the Changelog, no other changes were made. |
Description
This PR adds
parent_project_id
to the variable sets resource and data source, which specifies the ID of the project that should own the varset. Project-owned varsets cannot also be global varsets, and if the varset is updated to have a different parent project, then the varset under the old project should be deleted and then recreated under the new project.Remember to:
Testing plan
Creating a project-owned varset
Updating a project-owned varset’s project_id
Note that the resource is destroyed and created with the new project_id.
Creating an invalid project-owned varset where global is set to true
Output from acceptance tests
Tested against environment where beta feature is enabled:
Also tested against environment where beta feature is disabled
Output from Documentation Preview
Resource
Data source
tfe_workspace_variable_set
tfe_project_variable_set