Terraform Container Plugin
The Terraform container plugin allows you to set up infrastructure from Release. It can create new resources, update existing ones, or delete resources defined in your configuration. It clones the Git repository for Terraform files and executes the apply and delete commands. It does not maintain the state files terraform.tfstate. Also, provide the backend configuration for the state in your Terraform configuration file.
In the release flow editor, Container tasks have a blue border.
Terraform provides the following features:
- Apply (Container)
- Destroy (Container)
Prerequisites
For Terraform integration, you need the Digital.ai Release Runner setup to run the container tasks.
Apply (Container)
The Apply (Container) task is used to execute terraform module for the apply command.
- In the release flow tab of a Release template, add a task of type Terraform > Apply (Container).
- Click the added task to open it.
- In the Capabilities field, enter a value that matches the capability set for your Runner. This will help you to route jobs to that particular Runner.
- In the Terraform Client Version field, the version of the installed Terraform client is displayed.
- In the Git URL field, enter the URL of the GIT repository with Terraform files.
- In the Branch field, enter the branch of the GIT repository.
- In the Git directory path field, enter the directory path of the GIT repository where Terraform files are stored.
- In the Git Token field, enter the PAT to connect to the GIT repository.
- In the Environment Variables field, enter the Terraform environment variables the following format: {'VAR1': 'value1', 'VAR2': 'value2'}
- Example for AWS Environment Variables : {'AWS_ACCESS_KEY_ID': 'Your value', 'AWS_SECRET_ACCESS_KEY': 'Your value', 'AWS_SESSION_TOKEN': 'Your value'}
Destroy (Container)
The Destroy (Container) task is used to execute terraform module for the destroy command.
- In the release flow tab of a Release template, add a task of type Terraform > Delete (Container).
- Click the added task to open it.
- In the Capabilities field, enter a value that matches the capability set for your Runner. This will help you to route jobs to that particular Runner.
- In the Terraform Client Version field, the version of the installed Terraform client is displayed.
- In the Git URL field, enter the URL of the GIT repository with Terraform files.
- In the Branch field, enter the branch of the GIT repository.
- In the Git directory path field, enter the directory path of the GIT repository where Terraform files are stored.
- In the Git Token field, enter the PAT to connect to the GIT repository.
- In the Environment Variables field, enter the Terraform environment variables the following format: {'VAR1': 'value1', 'VAR2': 'value2'}
- Example for AWS Environment Variables : {'AWS_ACCESS_KEY_ID': 'Your value', 'AWS_SECRET_ACCESS_KEY': 'Your value', 'AWS_SESSION_TOKEN': 'Your value'}