Codify assets to Terraform

Codify assets and create reusable code. This code uses resource descriptions instead of resource IDs so that the code can be used in other subnets.

Procedure

  1. Select Inventory.

  2. Select the asset(s) and Codify > Terraform.

The code describes the configuration of the dependencies rather than referencing the specific ID. The following codification options are available:

Preview represents an experimental version of the codification feature.

Generating Import Blocks

Import existing resources into Terraform and bring them under its management.

Import blocks are only available in Terraform v.1.50 or later.

Procedure

  1. To generate the block for your Terraform code, switch the Import Blocks toggle.

  2. To preview the import plan and generate configuration for your resources, run the terraform plan command.

  3. Copy the code, and add the block to your Terraform configuration file.

Generating Provider Blocks

To create the Terraform provider configuration, generate a provider block.

Procedure

  1. Switch the Provider Block toggle.

  2. Copy the code, and add the block to your Terraform configuration file.

Using the Terraform import command

Terraform imports your existing infrastructure resources and brings them under its management. Each remote object must be imported to only one Terraform resource address.

Procedure

  1. To import the resource into your state file, select >_ Import Commands, and copy or export the code.

  2. Open the Terraform console, and paste the Terraform code into your Terraform file.

  3. Run the command in your Terraform file.

Codify Revision

Roll back any asset to a previous revision.

Procedure

  1. Select Inventory.

  2. To view your assets with a revision history, select Asset History.

  3. Select the asset and Asset History.

  4. To codify the previous revision of the asset, select Codify Revision.

Creating a pull request

Add your Terraform resources to your integrated version control system (VCS). Resources can be added to an existing file in your VCS by selecting a target branch and file path.

Procedure

  1. Select Pull request.

  2. Select a VCS Integration.

  3. Select a Repository.

    • Optional: Select the Target Branch.

    • Optional: Add a File Path. Select Browse Repository and locate the destination file.

  4. Select Create.

Last updated