From 0d48cc56369f339de0c876b46892bcdd7b89066c Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Thu, 3 Oct 2024 15:16:14 +1000 Subject: [PATCH] Add example for add variable into library variable set --- docs/resources/variable.md | 10 +++++++++- examples/resources/octopusdeploy_variable/resource.tf | 8 ++++++++ octopusdeploy_framework/schemas/variable.go | 3 ++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/resources/variable.md b/docs/resources/variable.md index 6b4c2408b..a0391cef0 100644 --- a/docs/resources/variable.md +++ b/docs/resources/variable.md @@ -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" +} ``` @@ -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)) diff --git a/examples/resources/octopusdeploy_variable/resource.tf b/examples/resources/octopusdeploy_variable/resource.tf index 693e90d20..470f881c8 100644 --- a/examples/resources/octopusdeploy_variable/resource.tf +++ b/examples/resources/octopusdeploy_variable/resource.tf @@ -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" +} \ No newline at end of file diff --git a/octopusdeploy_framework/schemas/variable.go b/octopusdeploy_framework/schemas/variable.go index 9d2ffb6c4..5d983e7a3 100644 --- a/octopusdeploy_framework/schemas/variable.go +++ b/octopusdeploy_framework/schemas/variable.go @@ -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)), },