Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from pogosoftware/feature/workspace-variables
Browse files Browse the repository at this point in the history
feat(workspace): Added workspace variables
  • Loading branch information
scrhicks authored Mar 1, 2024
2 parents afab654 + 09e234a commit ce17549
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ No modules.
| [tfe_variable.tfc_aws_plan_role_arn](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) | resource |
| [tfe_variable.tfc_aws_provider_auth](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) | resource |
| [tfe_variable.tfc_aws_workload_identity_audience](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) | 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_github_app_installation.gha_installation](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/data-sources/github_app_installation) | data source |
| [tfe_organization.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/data-sources/organization) | data source |
Expand All @@ -47,6 +48,7 @@ No modules.
| <a name="input_vcs_repos"></a> [vcs\_repos](#input\_vcs\_repos) | Settings for the workspace's VCS repository | <pre>object({<br> identifier = string<br> branch = string<br> })</pre> | `null` | no |
| <a name="input_working_directory"></a> [working\_directory](#input\_working\_directory) | A relative path that Terraform will execute within | `string` | `""` | no |
| <a name="input_workspace"></a> [workspace](#input\_workspace) | The name of TFC workspace | `string` | n/a | yes |
| <a name="input_workspace_variables"></a> [workspace\_variables](#input\_workspace\_variables) | The workspace variables | <pre>map(object({<br> value = string<br> category = string<br> description = optional(string)<br> }))</pre> | `{}` | no |

## Outputs

Expand Down
10 changes: 10 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,13 @@ resource "tfe_variable" "tfc_aws_apply_role_arn" {
category = "env"
workspace_id = tfe_workspace.this.id
}

resource "tfe_variable" "this" {
for_each = var.workspace_variables

key = each.key
value = each.value.value
category = lookup(each.value, "category", "terraform")
workspace_id = tfe_workspace.this.id
description = lookup(each.value, "description", "")
}
10 changes: 10 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ variable "speculative_enabled" {
type = bool
}

variable "workspace_variables" {
default = {}
description = "The workspace variables"
type = map(object({
value = string
category = string
description = optional(string)
}))
}

### AWS AUTH PROVIDER
variable "aws_provider_auth" {
default = false
Expand Down

0 comments on commit ce17549

Please sign in to comment.