Closed floreks closed 2 months ago
Tested with the following stack.
resource "random_string" "random" { length = var.random_string_length upper = var.random_string_upper special = var.random_string_special } resource "null_resource" "default" { provisioner "local-exec" { command = "${var.null_resource_command} ${random_string.random.result}" } } output "test" { value = random_string.random.result }
variable "random_string_length" { type = number default = 5 } variable "random_string_upper" { type = bool default = false } variable "random_string_special" { type = bool default = false } variable "null_resource_command" { type = string default = "echo" }
apiVersion: deployments.plural.sh/v1alpha1 kind: InfrastructureStack metadata: name: floreks-stack-variables-basic namespace: default spec: detach: true type: TERRAFORM approval: true workdir: variables configuration: image: ghcr.io/pluralsh/harness version: sha-e9b2089-terraform-1.8 repositoryRef: name: tf-test namespace: default clusterRef: name: existing namespace: default git: ref: main folder: terraform variables: random_string_length: 10 random_string_upper: true null_resource_command: "echo prefix-"
PROD-2482 support stack variables
Tested with the following stack.
Terraform (main.tf)
Terraform (variables.tf)
InfrastructureStack CRD