Skip to content

Commit

Permalink
converted variable scope to a list nested attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
benPearce1 committed Aug 22, 2024
1 parent 7f67da7 commit 5edee49
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions docs/data-sources/project_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ data "octopusdeploy_project_groups" "example" {
### Read-Only

- `id` (String) The unique ID for this resource.
- `project_groups` (Block List) A list of project groups that match the filter(s). (see [below for nested schema](#nestedblock--project_groups))
- `project_groups` (Attributes List) A list of project groups that match the filter(s). (see [below for nested schema](#nestedatt--project_groups))

<a id="nestedblock--project_groups"></a>
<a id="nestedatt--project_groups"></a>
### Nested Schema for `project_groups`

Read-Only:
Expand Down
32 changes: 17 additions & 15 deletions docs/data-sources/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ data "octopusdeploy_variables" "example" {

### Optional

- `scope` (Block List) As variable names can appear more than once under different scopes, a VariableScope must also be provided (see [below for nested schema](#nestedblock--scope))
- `space_id` (String) A Space ID to filter by. Will revert what is specified on the provider if not set.

### Read-Only
Expand All @@ -37,24 +36,11 @@ data "octopusdeploy_variables" "example" {
- `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.
- `prompt` (Attributes List) (see [below for nested schema](#nestedatt--prompt))
- `scope` (Attributes List) As variable names can appear more than once under different scopes, a VariableScope must also be provided (see [below for nested schema](#nestedatt--scope))
- `sensitive_value` (String, Sensitive)
- `type` (String) The type of variable represented by this resource. Valid types are `AmazonWebServicesAccount`, `AzureAccount`, `GoogleCloudAccount`, `UsernamePasswordAccount`, `Certificate`, `Sensitive`, `String`, `WorkerPool`.
- `value` (String)

<a id="nestedblock--scope"></a>
### Nested Schema for `scope`

Optional:

- `actions` (List of String) A list of actions that are scoped to this variable value.
- `channels` (List of String) A list of channels that are scoped to this variable value.
- `environments` (List of String) A list of environments that are scoped to this variable value.
- `machines` (List of String) A list of machines that are scoped to this variable value.
- `processes` (List of String) A list of processes that are scoped to this variable value.
- `roles` (List of String) A list of roles that are scoped to this variable value.
- `tenant_tags` (List of String) A list of tenant tags that are scoped to this variable value.


<a id="nestedatt--prompt"></a>
### Nested Schema for `prompt`

Expand Down Expand Up @@ -82,3 +68,19 @@ Read-Only:
- `value` (String) The select value




<a id="nestedatt--scope"></a>
### Nested Schema for `scope`

Optional:

- `actions` (List of String) A list of actions that are scoped to this variable value.
- `channels` (List of String) A list of channels that are scoped to this variable value.
- `environments` (List of String) A list of environments that are scoped to this variable value.
- `machines` (List of String) A list of machines that are scoped to this variable value.
- `processes` (List of String) A list of processes that are scoped to this variable value.
- `roles` (List of String) A list of roles that are scoped to this variable value.
- `tenant_tags` (List of String) A list of tenant tags that are scoped to this variable value.


4 changes: 1 addition & 3 deletions octopusdeploy_framework/schemas/variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ func GetVariableDatasourceSchema() datasourceSchema.Schema {
Computed: true,
},
VariableSchemaAttributeNames.Prompt: getVariablePromptDatasourceSchema(),
},
Blocks: map[string]datasourceSchema.Block{
VariableSchemaAttributeNames.Scope: getVariableScopeDatasourceSchema(),
VariableSchemaAttributeNames.Scope: getVariableScopeDatasourceSchema(),
},
}
}
Expand Down
7 changes: 4 additions & 3 deletions octopusdeploy_framework/schemas/variable_scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,11 @@ func getVariableScopeFieldResourceSchema(scopeDescription string) resourceSchema
}
}

func getVariableScopeDatasourceSchema() datasourceSchema.ListNestedBlock {
return datasourceSchema.ListNestedBlock{
func getVariableScopeDatasourceSchema() datasourceSchema.ListNestedAttribute {
return datasourceSchema.ListNestedAttribute{
Description: "As variable names can appear more than once under different scopes, a VariableScope must also be provided",
NestedObject: datasourceSchema.NestedBlockObject{
Computed: true,
NestedObject: datasourceSchema.NestedAttributeObject{
Attributes: map[string]datasourceSchema.Attribute{
variableScopeFieldNames.Actions: getVariableScopeFieldDatasourceSchema(variableScopeFieldNames.Actions),
variableScopeFieldNames.Channels: getVariableScopeFieldDatasourceSchema(variableScopeFieldNames.Channels),
Expand Down

0 comments on commit 5edee49

Please sign in to comment.