github.com/terraform-modules-krish/terratest@v0.29.0/modules/terraform/options.go (about)

     1  package terraform
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/terraform-modules-krish/terratest/modules/logger"
     7  	"github.com/terraform-modules-krish/terratest/modules/ssh"
     8  )
     9  
    10  // Options for running Terraform commands
    11  type Options struct {
    12  	TerraformBinary string // Name of the binary that will be used
    13  	TerraformDir    string // The path to the folder where the Terraform code is defined.
    14  
    15  	// The vars to pass to Terraform commands using the -var option. Note that terraform does not support passing `null`
    16  	// as a variable value through the command line. That is, if you use `map[string]interface{}{"foo": nil}` as `Vars`,
    17  	// this will translate to the string literal `"null"` being assigned to the variable `foo`. However, nulls in
    18  	// lists and maps/objects are supported. E.g., the following var will be set as expected (`{ bar = null }`:
    19  	// map[string]interface{}{
    20  	//     "foo": map[string]interface{}{"bar": nil},
    21  	// }
    22  	Vars map[string]interface{}
    23  
    24  	VarFiles                 []string               // The var file paths to pass to Terraform commands using -var-file option.
    25  	Targets                  []string               // The target resources to pass to the terraform command with -target
    26  	Lock                     bool                   // The lock option to pass to the terraform command with -lock
    27  	LockTimeout              string                 // The lock timeout option to pass to the terraform command with -lock-timeout
    28  	EnvVars                  map[string]string      // Environment variables to set when running Terraform
    29  	BackendConfig            map[string]interface{} // The vars to pass to the terraform init command for extra configuration for the backend
    30  	RetryableTerraformErrors map[string]string      // If Terraform apply fails with one of these (transient) errors, retry. The keys are a regexp to match against the error and the message is what to display to a user if that error is matched.
    31  	MaxRetries               int                    // Maximum number of times to retry errors matching RetryableTerraformErrors
    32  	TimeBetweenRetries       time.Duration          // The amount of time to wait between retries
    33  	Upgrade                  bool                   // Whether the -upgrade flag of the terraform init command should be set to true or not
    34  	NoColor                  bool                   // Whether the -no-color flag will be set for any Terraform command or not
    35  	SshAgent                 *ssh.SshAgent          // Overrides local SSH agent with the given in-process agent
    36  	NoStderr                 bool                   // Disable stderr redirection
    37  	Logger                   *logger.Logger         // Set a non-default logger that should be used. See the logger package for more info.
    38  	Parallelism              int                    // Set the parallelism setting for Terraform
    39  }