Before you add a Terraform configuration to a Cloud Assembly template, set up and integrate your version control repository.

  1. About the Terraform runtime environment
  2. Store Terraform configuration files in a version control repository
  3. Enable cloud zone mapping
  4. Integrate your repository with Cloud Assembly

About the Terraform runtime environment

Designs that include Terraform configurations require access to a Terraform runtime environment. The runtime environment consists of a Kubernetes cluster that runs Terraform CLI commands to perform requested operations. In addition, the runtime collects logs and returns the results from Terraform CLI commands.

The vRealize Automation Cloud hosted service uses its own preconfigured Kubernetes cluster that can't be modified by users.

Store Terraform configuration files in a version control repository

Cloud Assembly supports the following version control repositories for Terraform configurations.

  • GitHub cloud, GitHub Enterprise on-premises
  • GitLab cloud

In your version control repository, create a default directory with one layer of subdirectories, each with Terraform configuration files. Create one subdirectory per Terraform configuration.

  1. Default directory
  2. Single subdirectory layer
  3. Deployment-ready Terraform configuration files

    Don't include a Terraform state file with configuration files. If terraform.tfstate is present, errors occur during deployment.

Repository directory structure

Enable cloud zone mapping

If you expect to deploy to a cloud account, the Terraform runtime engine needs those cloud zone credentials.

In the project Provisioning tab, enable Allow Terraform cloud zone mapping.

Terraform cloud zone mapping enabled

Even though credentials are securely transmitted, for additional security, you should leave the option deactivated if project users don't need to deploy to a cloud account.

Integrate your repository with Cloud Assembly

In Cloud Assembly, go to Infrastructure > Connections > Integrations.

Add an integration to the repository offering type where you stored the Terraform configurations: GitHub or GitLab.

When you add your project to the integration, select the Terraform Configurations type, and identify the repository and branch.

Folder is the default directory of your earlier structure.

Terraform repository integration