Skip to content

Commit

Permalink
feat: adds passing terraform_workflow_tool to spacelift-stack module 🍜 (
Browse files Browse the repository at this point in the history
  • Loading branch information
Gowiem authored Jan 10, 2024
1 parent 1b5ccf4 commit d36df8d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/spacelift/admin-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ components:
| <a name="input_terraform_smart_sanitization"></a> [terraform\_smart\_sanitization](#input\_terraform\_smart\_sanitization) | Whether or not to enable [Smart Sanitization](https://docs.spacelift.io/vendors/terraform/resource-sanitization) which will only sanitize values marked as sensitive. | `bool` | `false` | no |
| <a name="input_terraform_version"></a> [terraform\_version](#input\_terraform\_version) | Specify the version of Terraform to use for the stack | `string` | `null` | no |
| <a name="input_terraform_version_map"></a> [terraform\_version\_map](#input\_terraform\_version\_map) | A map to determine which Terraform patch version to use for each minor version | `map(string)` | `{}` | no |
| <a name="input_terraform_workflow_tool"></a> [terraform\_workflow\_tool](#input\_terraform\_workflow\_tool) | Defines the tool that will be used to execute the workflow. This can be one of OPEN\_TOFU, TERRAFORM\_FOSS or CUSTOM. Defaults to TERRAFORM\_FOSS. | `string` | `"TERRAFORM_FOSS"` | no |
| <a name="input_terraform_workspace"></a> [terraform\_workspace](#input\_terraform\_workspace) | Specify the Terraform workspace to use for the stack | `string` | `null` | no |
| <a name="input_webhook_enabled"></a> [webhook\_enabled](#input\_webhook\_enabled) | Flag to enable/disable the webhook endpoint to which Spacelift sends the POST requests about run state changes | `bool` | `false` | no |
| <a name="input_webhook_endpoint"></a> [webhook\_endpoint](#input\_webhook\_endpoint) | Webhook endpoint to which Spacelift sends the POST requests about run state changes | `string` | `null` | no |
Expand Down
1 change: 1 addition & 0 deletions modules/spacelift/admin-stack/child-stacks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ module "child_stack" {
stack_name = try(each.value.settings.spacelift.stack_name, each.key)
terraform_smart_sanitization = try(each.value.settings.spacelift.terraform_smart_sanitization, var.terraform_smart_sanitization)
terraform_version = lookup(var.terraform_version_map, try(each.value.settings.spacelift.terraform_version, ""), var.terraform_version)
terraform_workflow_tool = try(each.value.settings.spacelift.terraform_workflow_tool, var.terraform_workflow_tool)
webhook_enabled = try(each.value.settings.spacelift.webhook_enabled, var.webhook_enabled)
webhook_endpoint = try(each.value.settings.spacelift.webhook_endpoint, var.webhook_endpoint)
webhook_secret = try(each.value.settings.spacelift.webhook_secret, var.webhook_secret)
Expand Down
1 change: 1 addition & 0 deletions modules/spacelift/admin-stack/root-admin-stack.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ module "root_admin_stack" {
stack_name = var.stack_name != null ? var.stack_name : local.root_admin_stack_name
terraform_smart_sanitization = try(local.root_admin_stack_config.settings.spacelift.terraform_smart_sanitization, var.terraform_smart_sanitization)
terraform_version = lookup(var.terraform_version_map, try(local.root_admin_stack_config.settings.spacelift.terraform_version, ""), var.terraform_version)
terraform_workflow_tool = try(local.root_admin_stack_config.settings.spacelift.terraform_workflow_tool, var.terraform_workflow_tool)
webhook_enabled = try(local.root_admin_stack_config.settings.spacelift.webhook_enabled, var.webhook_enabled)
webhook_endpoint = try(local.root_admin_stack_config.settings.spacelift.webhook_endpoint, var.webhook_endpoint)
webhook_secret = try(local.root_admin_stack_config.settings.spacelift.webhook_secret, var.webhook_secret)
Expand Down
11 changes: 11 additions & 0 deletions modules/spacelift/admin-stack/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,17 @@ variable "terraform_version_map" {
default = {}
}

variable "terraform_workflow_tool" {
type = string
description = "Defines the tool that will be used to execute the workflow. This can be one of OPEN_TOFU, TERRAFORM_FOSS or CUSTOM. Defaults to TERRAFORM_FOSS."
default = "TERRAFORM_FOSS"

validation {
condition = contains(["OPEN_TOFU", "TERRAFORM_FOSS", "CUSTOM"], var.terraform_workflow_tool)
error_message = "Valid values for terraform_workflow_tool are (OPEN_TOFU, TERRAFORM_FOSS, CUSTOM)."
}
}

variable "terraform_workspace" {
type = string
description = "Specify the Terraform workspace to use for the stack"
Expand Down

0 comments on commit d36df8d

Please sign in to comment.