Terraform Problems and Solutions

Running simultaneous terraform workflows on the same delegates will fail?

The terraform working directory is constructed in the following way,
./terraform-working-dir/{ACCOUNT_ID}/{PROVISIONER_ID}-${ENVIRONMENT_ID}

If the user has defined a workspace, the directory would be defined as,
./terraform-working-dir/{ACCOUNT_ID}/{PROVISIONER_ID}-{ENVIRONMENT_ID}-{WORKSPACE}

Use different delegates if you have to run the same terraform workflows simultaneously, or you can use [Control Resource Usage - Harness.io Docs] to get them to run consecutively.

Exponentially growing interpretation while evaluating expression

Harness looks through variables multiple times, attempting to do substitutions of nested Harness Variables.

Example:

We have two variables, where we evaluate the {Sentence} before the {NameIntro}

{Sentence} = "Hello, {NameIntro}"
{NameIntro} = "My name is {Person}"

Or first Substitutition change ${Sentence} to,

{Sentence} = "Hello, My name is {Person}"

The second pass would then replace the value for ${Person}

Exponential growth becomes an issue when the variables’ size becomes greater than 256K, AND we still have to do variable substitutions. The operation becomes very expensive, and we exit gracefully rather than have the delegate process potentially crash.

The second place that this is a problem is when outside tools use the pattern as Harness Variables. These variables are not intended to be evaluated by Harness but are identified as substitutions. If the size of the terraform plan becomes greater than 256k, we exit the step.

There is no current workaround beyond avoiding modules that introduce that syntax or avoid having plans greater than 256K. Specific modules we have encountered this error is when using VPC Flow Logs with Terraform.

1 Like