tencent cloud


Installing and Configuring Terraform

Last updated: 2022-12-13 16:26:51

    This document describes how to install and configure Terraform.

    Step 1. Install Terraform

    1. Go to Terraform official website and use the command line to install Terraform directly or download the binary installation file.
    2. Unzip the file and configure the global path.
      Skip this step if you use the command line.
      1. Run the following command to unzip the file. Replace 1.x.x with the actual version number of Terraform to be installed.
        unzip terraform_1.x.x_linux_amd64.zip
      2. Run the following command to add the current directory to the ~/.profile file.
        echo $"export PATH=\$PATH:$(pwd)" >> ~/.bash_profile
      3. Run the following command to make the global path configuration take effect.
        source ~/.bash_profile
    3. Run the following command to check whether the installation is successful.
      terraform  -version

    If the following information is returned (the version number may be different), the installation is successful:

    > Terraform v1.0.10
    > on darwin_amd64
    > Your version of Terraform is out of date! The latest version
    > is 1.1.0. You can update by downloading from https://www.terraform.io/downloads.html

    Step 2. Configure security credentials

    Before using Terraform for the first time, go to the TencentCloud API Key page to apply for SecretId and SecretKey. If you already have them, go to step 3.

    1. Log in to the CAM console and select Access Key > Manage API Key on the left sidebar.

    2. On the Manage API Key page, click Create Key to create a pair of SecretId/SecretKey.

    3. You can authenticate in two ways:

      Add the following content to the environment variable configuration:
      Replace <your-secret-id> and <your-secret-key> with SecretId and SecretKey obtained in the Get credentials step.

      export TENCENTCLOUD_SECRET_ID=<your-secret-id>
      export TENCENTCLOUD_SECRET_KEY=<your-secret-key>

    4. At this point, you have installed Terraform and configured the environment variable. You can now proceed to create a site through Terraform.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support