Run a Test Configuration for the Commvault Terraform Module

Updated

To verify the Commvault Terraform module is set up correctly and the basic Terraform concepts are clear, run a test configuration. This test configuration uses the commvault_user resource to create and delete a user.

Create a User

This test configuration creates a user in the CommCell environment.

  1. On your computer, go to the folder that has the main.tf file.

  2. Copy the following resource block, and then paste it into the main.tf file:

    resource "commvault_user" "user1" 

    {

    user_name = "johndoe"

    password = "commvault"

    description = "This user is created using Terraform"

    full_name = "John Doe"

    email = "jdoe@testmail.com"

    }
  3. Save the main.tf file.

  4. Launch the Windows command prompt.

  5. Go to the directory that has the main.tf file.

  6. To initialize the working directory, enter the following command:

    Terraform init
  7. To create an execution plan, enter the following command:

    Terraform plan

    The plan displays the actions that will be performed. Because the configuration file contains only one resource, the plan displays that the user will be created.

  8. To apply the changes, enter the following command:

    Terraform apply

    The user "johndoe" is created in the CommCell environment.

Delete a User

This test configuration deletes the user from the CommCell environment.

  1. Open the main.tf configuration file.

  2. Delete the commvault_user resource block that represents the "johndoe" user.

  3. Save the main.tf configuration file.

  4. Go to the Windows command prompt.

  5. To create an execution plan, enter the following command:

    Terraform plan

    The plan displays the actions that will be performed. Because the configuration file contains only one resource, the plan displays that the user will be deleted.

  6. To apply the changes, enter the following command:

    Terraform apply

    The user "johndoe" is deleted from the CommCell environment.