Skip to content

Commit

Permalink
Merge pull request #8 from jpetrucciani/main
Browse files Browse the repository at this point in the history
feat: add allow_destroy_plan and auto_apply flags for workspaces
  • Loading branch information
mbevc1 authored Feb 22, 2023
2 parents 42b7670 + 10f0725 commit 0551bfb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ Apache 2 Licensed. See [LICENSE](LICENSE) for full details.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_TFC_WORKSPACE_NAME"></a> [TFC\_WORKSPACE\_NAME](#input\_TFC\_WORKSPACE\_NAME) | TFC workspace name from the ENV | `string` | `null` | no |
| <a name="input_allow_destroy_plan"></a> [allow\_destroy\_plan](#input\_allow\_destroy\_plan) | Whether destroy plans can be queued on the workspace | `bool` | `true` | no |
| <a name="input_assessments_enabled"></a> [assessments\_enabled](#input\_assessments\_enabled) | Regularly run health assessments such as drift detection on the workspace | `bool` | `false` | no |
| <a name="input_auto_apply"></a> [auto\_apply](#input\_auto\_apply) | Whether to automatically apply changes when a Terraform plan is successful | `bool` | `false` | no |
| <a name="input_execution_mode"></a> [execution\_mode](#input\_execution\_mode) | Terraform worskapce execution more: remote, local or agent | `string` | `"remote"` | no |
| <a name="input_oauth_token_id"></a> [oauth\_token\_id](#input\_oauth\_token\_id) | ID of the oAuth token for the VCS connection | `string` | n/a | yes |
| <a name="input_organization"></a> [organization](#input\_organization) | TF Organization to create workspaces under | `string` | n/a | yes |
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ resource "tfe_workspace" "workspace" {

name = each.key
description = "Workspace: ${each.key} | Triggered from path: ${each.value}"
allow_destroy_plan = true
allow_destroy_plan = var.allow_destroy_plan
organization = var.organization
terraform_version = local.tf_version
working_directory = each.value
file_triggers_enabled = true
auto_apply = false
auto_apply = var.auto_apply
execution_mode = var.execution_mode
structured_run_output_enabled = var.structured_run_output_enabled
assessments_enabled = var.assessments_enabled
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,24 @@ variable "structured_run_output_enabled" {
default = false
}

variable "allow_destroy_plan" {
description = "Whether destroy plans can be queued on the workspace"
type = bool
default = true
}

variable "assessments_enabled" {
description = "Regularly run health assessments such as drift detection on the workspace"
type = bool
default = false
}

variable "auto_apply" {
description = "Whether to automatically apply changes when a Terraform plan is successful"
type = bool
default = false
}

variable "speculative_enabled" {
description = "Weather running plans on pull requests"
type = bool
Expand Down

0 comments on commit 0551bfb

Please sign in to comment.