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.
-
On your computer, go to the folder that has the main.tf file.
-
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" } -
Save the main.tf file.
-
Launch the Windows command prompt.
-
Go to the directory that has the main.tf file.
-
To initialize the working directory, enter the following command:
Terraform init -
To create an execution plan, enter the following command:
Terraform planThe 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.
-
To apply the changes, enter the following command:
Terraform applyThe user "johndoe" is created in the CommCell environment.
Delete a User
This test configuration deletes the user from the CommCell environment.
-
Open the main.tf configuration file.
-
Delete the
commvault_userresource block that represents the "johndoe" user. -
Save the main.tf configuration file.
-
Go to the Windows command prompt.
-
To create an execution plan, enter the following command:
Terraform planThe 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.
-
To apply the changes, enter the following command:
Terraform applyThe user "johndoe" is deleted from the CommCell environment.