Be aware of certain limitations and troubleshooting when you embed Terraform configurations as a resource in vRealize Automation.

Limitations for Terraform configurations

  • When validating a design with Terraform configurations, the TEST button checks Cloud Assembly syntax but not the native Terraform code syntax.

    In addition, the TEST button doesn't validate commit IDs associated with Terraform configurations.

  • For a cloud template that includes Terraform configurations, cloning the template to a different project requires the following workaround.
    1. In the new project, under the Integrations tab, copy the repositoryId for your integration.
    2. Open the clone template. In the code editor, replace the repositoryId with the one you copied.
  • In the version control repository, don't include a Terraform state file with configuration files. If terraform.tfstate is present, errors occur during deployment.

Supported day 2 actions for the parent Terraform resource

For the parent Terraform resource, you can view or refresh the Terraform state file. For more about the state file actions, see the comprehensive list of actions at What actions can I run on Cloud Assembly deployments.

Supported day 2 actions for child resources

After deploying Terraform configurations, it might take up to 20 minutes for a day 2 action to become available on child resources.

For child resources in a Terraform configuration, only the following subset of day 2 actions are supported. For details about the actions, look them up in the comprehensive list of actions at What actions can I run on Cloud Assembly deployments.

Provider Terraform Resource Type Supported Day 2 Actions
AWS aws_instance Power On
Power Off
Reboot
Reset
Azure azurerm_virtual_machine Power On
Power Off
Restart
Suspend
vSphere vsphere_virtual_machine Power On
Power Off
Reboot
Reset
Shutdown
Suspend
Create Snapshot
Delete Snapshot
Revert Snapshot
GCP google_compute_instance Power On
Power Off
Create Snapshot
Delete Snapshot

Troubleshooting day 2 action availability

Out-of-the-box (OOTB) day 2 actions that are missing or deactivated might need troubleshooting.

Problem Cause Resolution
A Terraform resource does not have an expected OOTB day 2 action on the Actions menu.

The action might not be supported for the provider and resource type as mentioned in the previous list.

Alternatively, the action might need up to 20 minutes to appear due to the timing of resource discovery and resource caching.

Check the provider and resource type in the design.

Wait up to 20 minutes for data collection to complete.

A Terraform resource does not have an expected day 2 action even after the 20 minutes to account for data collection.

A resource discovery problem is preventing the action from appearing.

One way that happens is when the resource is accidentally created on an out-of-project cloud zone. For example, your project only includes a cloud account and region us-east-1 cloud zone, but the Terraform configuration includes a provider block for us-west-1, and you didn't change it at design time.

Another possibility is that data collection isn't working.

Check the project cloud zones against the cloud zones in the design.

Go to Infrastructure > Connections > Cloud Accounts and check the data collection status and last successful collection time for the cloud account.

Even though there are no obvious problems with the resource state and data collection, a day 2 action is deactivated (gray). Occasional, intermittent timing issues and data collection failures are known to occur. The problem should resolve itself within 20 minutes.
The wrong day 2 action is deactivated, one that should be active based on the resource state.

For example, Power Off is enabled, and Power On is deactivated, even though the resource was powered off using the provider interface.

Data collection timing can cause a temporary mismatch. If you change the power state from outside vRealize Automation, it takes time to correctly reflect the change. Wait up to 20 minutes.

Using custom Terraform providers in vRealize Automation

If you want to use a custom Terraform provider, take the following steps.

In your git version control repository, under the Terraform directory that contains main.tf, add the following subdirectory structure and your custom Terraform provider ZIP file.

terraform.d/plugins/<HOSTNAME>/<NAMESPACE>/<TYPE>/terraform-provider-<TYPE_VERSION_TARGET>.zip

For example, if you downloaded azurerm version 3.12.0, you create the following structure.

terraform.d/plugins/registry.terraform.io/hashicorp/azurerm/terraform-provider-azurerm_3.12.0_linux_amd64.zip