Terraform plugin
This topic provides information on using the Deploy Terraform plugin to apply and destroy Terraform resources.
For more information about the Deploy Terraform plugin requirements and the configuration items (CIs) that the plugin supports, see the Terraform Plugin Reference.
Using the Deploy Terraform plugin
The Deploy Terraform plugin can create and destroy Terraform resources using the Terraform client. To use the plugin:
- Download the Deploy Terraform plugin ZIP from the distribution site.
- Unpack the plugin inside the
XL_DEPLOY_SERVER_HOME/plugins/
directory. - Restart Deploy.
Create the Terraform client
To create a Terraform client in Deploy:
- Under Infrastructure create an
overthere.SshHost
oroverthere.LocalHost
CI, depending on the location of the Terraform client.- For the
overthere.SshHost
CI. Specify the following properties:os
: Operating system the host runs.connectionType
: Select SFTP as the type of SSH connection to create.address
: Address of the host.port
: Port on which the SSH server runs.
- For the
overthere.LocalHost
CI. Specify the following properties:os
: Operating system the host runs.
- For the
- Under the host, create a
terraform.TerraformClient
CI. Specify the following properties:path
: The path where the Terraform client executable is available.pluginDirectory
: The path where Terraform's pre-installed plugins are available. This is an optional property. If not provided, the required plugins will be downloaded byterraform init
.workingDirectory
: The path where Terraform maintains its state for incremental deployments.
Configure Terraform resources using artifact-based deployables
To configure Terraform resources:
- Under Applications, create an application (
udm.Application
) and a deployment package (udm.DeploymentPackage
). - Under the deployment package, create a
terraform.Module
CI. Specify the following properties:file
: The ZIP file that contains the Terraform template files. Terraform does not support a nested directory structure for these files, so all files must be placed at the root of the ZIP file.targets
: The list of resource names that you want to create or modify. It will skip other resources defined in Terraform template files.inputVariables
: The map of the name and value of the input variables whose values will be resolved in Terraform template files.outputVariables
: The map of the name and value of the output variables. This will be populated with the outputs defined in Terraform template files after the deployment.excludeFileTypes
: The list of file types which should be Excluded for transformation (Note: In case the file is not copied before execution, the file type should be added here).
Integrating Init Parameters and Secret Init Parameters
Deploy now supports specifying Init Parameters and Secret Init Parameters for Terraform modules, enhancing flexibility and security in your deployment processes. Additionally, cascading changes are applied for the Terraform Destroy flow, ensuring smoother and more comprehensive management of your infrastructure.