This plugin will let BitOps to automatically deploy terraform resources on any cloud provider. terraform plugin uses session variables while connecting to any cloud provider.
terraform plugin uses bitops.config.yaml located in the operations repo when deploying resources using terraform scripts.
terraform: {}
terraform:
cli:
var-file: my-vars.tfvars
targets:
- resource_identifier.foo
- resource_identifier.bar
backend-config:
- KEY1=foo
- KEY2=bar
stack-action: "plan"
options:
workspace: test
terraform will always run terraform init and terraform plan on every execution.
Run BitOps with the environmental variable TERRAFORM_APPLY set to true or set stack-action in the bitops.config.yaml file to apply to run terraform apply.
- BitOps Property:
var-file - CLI Argument:
--var-file - Environment Variable:
BITOPS_TF_VAR_FILE - default:
"" - Required:
false - Description: Terraform Varaible file
-
BitOps Property:
targets -
CLI Argument:
-target <target1> -target <target2> ... -
Usage:
targets: - resource.id1 - resource.id2 -
Environment Variable:
BITOPS_TF_TARGETS -
default:
"" -
Required:
false -
Description:
A yaml list of terraform resources that will be created prior to the full stack creation.
- BitOps Property:
backend-config - CLI Argument:
--KEY1=foo --KEY2=bar - Environment Variable: ``
- default:
"" - Required:
false - Description:
- BitOps Property:
stack-action - Environment Variable:
BITOPS_TERRAFORM_COMMAND - default:
"plan" - Required:
false - Description: Controls what terraform command to run. e.g.
apply,destroy, etc.
- BitOps Property:
skip-deploy - Environment Variable:
TERRAFORM_SKIP_DEPLOY - default:
none - Required:
"" - Description: If set to true, regardless of the stack-action, deployment actions will be skipped.
- BitOps Property:
workspace - Environment Variable:
BITOPS_TERRAFORM_WORKSPACE - default:
"" - Required:
false - Description: Will select a terraform workspace using
terraform workspace new $TERRAFORM_WORKSPACE || terraform workspace select $TERRAFORM_WORKSPACEprior to running other terraform commands.
Although not captured in bitops.config.yml, the following environment variables can be set to further customize behaviour. Set the value of the environental variable to true to use
Will force call terraform apply
Will force call terraform destroy
Will add --upgrade flag to the init command