Skip to content
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 example for add variable into library variable set #791

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 for 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)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: "Owner ID for the variable(e.g., project ID or library variable set ID)",
Description: "Owner ID of 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
Loading