Skip to content

Commit

Permalink
Add example for add variable into library variable set
Browse files Browse the repository at this point in the history
  • Loading branch information
HuyPhanNguyen committed Oct 3, 2024
1 parent d2f1fd3 commit 0d48cc5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
10 changes: 9 additions & 1 deletion docs/resources/variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ resource "octopusdeploy_variable" "prompted_variable" {
label = "Variable Label"
}
}
# create a String variable to a library variable set
resource "octopusdeploy_variable" "string_variable" {
owner_id = "LibraryVariableSets-123"
type = "String"
name = "My String Value (OK to Delete)"
value = "PlainText"
}
```

<!-- schema generated by tfplugindocs -->
Expand All @@ -103,7 +111,7 @@ resource "octopusdeploy_variable" "prompted_variable" {
- `description` (String) The description of this variable.
- `is_editable` (Boolean) Indicates whether or not this variable is considered editable.
- `is_sensitive` (Boolean) Indicates whether or not this resource is considered sensitive and should be kept secret.
- `owner_id` (String)
- `owner_id` (String) Owner ID for the variable(e.g., project ID or library variable set ID)
- `project_id` (String, Deprecated)
- `prompt` (Block List) (see [below for nested schema](#nestedblock--prompt))
- `scope` (Block List) (see [below for nested schema](#nestedblock--scope))
Expand Down
8 changes: 8 additions & 0 deletions examples/resources/octopusdeploy_variable/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,11 @@ resource "octopusdeploy_variable" "prompted_variable" {
label = "Variable Label"
}
}

# create a String variable to a library variable set
resource "octopusdeploy_variable" "string_variable" {
owner_id = "LibraryVariableSets-123"
type = "String"
name = "My String Value (OK to Delete)"
value = "PlainText"
}
3 changes: 2 additions & 1 deletion octopusdeploy_framework/schemas/variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ func (v VariableSchema) GetResourceSchema() resourceSchema.Schema {
SchemaAttributeNames.Description: GetDescriptionResourceSchema(VariableResourceDescription),
SchemaAttributeNames.SpaceID: GetSpaceIdResourceSchema(VariableResourceDescription),
VariableSchemaAttributeNames.OwnerID: resourceSchema.StringAttribute{
Optional: true,
Description: "Owner ID for the variable(e.g., project ID or library variable set ID)",
Optional: true,
Validators: []validator.String{
stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName(VariableSchemaAttributeNames.ProjectID)),
},
Expand Down

0 comments on commit 0d48cc5

Please sign in to comment.