diff --git a/README.md b/README.md index 9af016c..f839ca9 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Terraform module to provision and manage Terraform Cloud workspaces - Run Triggers - Version Control - Variables +- Variable Set assignments :warning: For Notifications configuration, only "webhook", "slack" and "microsoft-teams" types are supported at the moment @@ -95,6 +96,10 @@ module "my_workspace" { } ``` +## Integrations + +It is possible to integrate this module with [tfe-variable-set module](https://registry.terraform.io/modules/flowingis/variable-set/tfe/latest), in order to assign one or more variable sets to the workspace. + ## Requirements @@ -123,6 +128,7 @@ No modules. | [tfe_run_trigger.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/run_trigger) | resource | | [tfe_variable.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) | resource | | [tfe_workspace.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/workspace) | resource | +| [tfe_workspace_variable_set.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/workspace_variable_set) | resource | ## Inputs @@ -158,6 +164,7 @@ No modules. | [terraform\_version](#input\_terraform\_version) | (Required) The version of Terraform to use for this workspace | `string` | n/a | yes | | [trigger\_patterns](#input\_trigger\_patterns) | (Optional) List of glob patterns that describe the files Terraform Cloud monitors for changes. Trigger patterns are always appended to the root directory of the repository. Mutually exclusive with trigger-prefixes. Only available for Terraform Cloud | `list(string)` | `null` | no | | [trigger\_prefixes](#input\_trigger\_prefixes) | (Optional) List of repository-root-relative paths which describe all locations to be tracked for changes | `list(string)` | `null` | no | +| [variable\_set\_ids](#input\_variable\_set\_ids) | List of variable set ids applied to this workspace | `list(string)` | `[]` | no | | [variables\_descriptions](#input\_variables\_descriptions) | (Optional) Map of descriptions applied to workspace variables

Item syntax:
{
variable1\_name = "description"
variable2\_name = "description"
...
} | `map(string)` | `{}` | no | | [vcs\_repository\_branch](#input\_vcs\_repository\_branch) | (Optional) The repository branch that Terraform will execute from | `string` | `""` | no | | [vcs\_repository\_identifier](#input\_vcs\_repository\_identifier) | (Optional) A reference to your VCS repository in the format / where and refer to the organization and repository in your VCS provider. The format for Azure DevOps is //\_git/ | `string` | `""` | no | diff --git a/main.tf b/main.tf index 4e99be0..f617a8e 100644 --- a/main.tf +++ b/main.tf @@ -151,3 +151,10 @@ resource "tfe_notification_configuration" "microsoft_teams" { url = lookup(var.notification_microsoft_teams_configuration[count.index], "url") workspace_id = tfe_workspace.this.id } + +resource "tfe_workspace_variable_set" "this" { + for_each = toset(var.variable_set_ids) + + variable_set_id = each.key + workspace_id = tfe_workspace.this.id +} diff --git a/variables.tf b/variables.tf index c09b6ae..015e349 100644 --- a/variables.tf +++ b/variables.tf @@ -413,3 +413,9 @@ EOT default = [] } + +variable "variable_set_ids" { + description = "List of variable set ids applied to this workspace" + type = list(string) + default = [] +}