All Products
Search
Document Center

Enterprise Distributed Application Service:Install and configure Terraform

Last Updated:Oct 27, 2025

Install and configure Terraform before using it to define, preview, and deploy cloud infrastructure.

Procedure

  1. Download the appropriate package for your operating system from the Terraform.

  2. Extract the package to /usr/local/bin.

  3. Run terraform to verify the installation.

    You should see output similar to this:

    username:~$ terraform
    Usage: terraform [-version] [-help] <command> [args]
  4. Create a RAM user for better security.

    1. Log on to the Resource Access Management (RAM) console by using an Alibaba Cloud account.

    2. Create a RAM user named Terraform and create an AccessKey pair. For more information, see Create a RAM user.

    3. Grant permissions to the RAM user. In this example, grant AliyunEDASFullAccess and AliyunVPCFullAccess to the Terraform user. For more information, see Grant permissions to a RAM user.

  5. Create a test directory.

    Each Terraform project needs its own working directory. Create a test directory named terraform-test:

    [user@test bin]#mkdir terraform-test
  6. Navigate to the terraform-test directory.

    [user@test bin]#cd terraform-test
    [user@test terraform-test]#
  7. Create configuration files.

    Terraform reads all *.tf and *.tfvars files in the directory. You can organize your configuration across multiple files:

    provider.tf           -- used to configure providers
    terraform.tfvars      -- used to configure the variables that are required to configure providers
    varable.tf            -- used to configure universal variables
    resource.tf           -- used to define resources
    data.tf               -- used to define package files
    output.tf             -- used to configure outputs

    For example, create provider.tf with your credentials:

    [user@test terraform-test]# vim provider.tf
    provider "alicloud" {
        region      = "cn-beijing"
        access_key  = "LTA**********NO2"
        secret_key  = "MOk8x0*********************wwff"
    }

    For more information about the configuration, see alicloud_edas_application.

  8. Initialize the working directory.

    [user@test terraform-test]#terraform init
    
    
    Initializing provider plugins...
    - Checking for available provider plugins on https://releases.hashicorp.com...
    - Downloading plugin for provider "alicloud" (1.25.0)...
    
    
    
    
    The following providers do not have any version constraints in configuration,
    so the latest version was installed.
    
    
    To prevent automatic upgrades to new major versions that may contain breaking
    changes, it is recommended to add version = "..." constraints to the
    corresponding provider blocks in configuration, with the constraint strings
    suggested below.
    
    
    * provider.alicloud: version = "~> 1.25"
    
    
    Terraform has been successfully initialized!
    
    
    You may now begin working with Terraform. Try running "terraform plan" to see
    any changes that are required for your infrastructure. All Terraform commands
    should now work.
    
    
    If you ever set or change modules or backend configuration for Terraform,
    rerun this command to reinitialize your working directory. If you forget, other
    commands will detect it and remind you to do so if necessary.                        
    Important

    You must run terraform init after creating a working directory and configuration files.