Start playing Terraform

Get it downloaded & saved it to a local folder: C:\bin

Put this path into local $PATH var by running:

Restart a command line, type in “terraform”:

Once you can see above, “Terraform” is correctly installed.


Due to I only have Azure account, so I’ll start playing with this…

  1. Create a terraform file with following content
  2. Login to Azure legacy portal:
  3. Getting ‘client_id’, ‘client_secret’ and ‘tenant_id’:
    1. client_id
      1. Select “Active Directory”
      2. Select “Applications”
      3. Select “Add” – “Add an application my organization is developing”

      4. Give it a good name “Terrabot”

      5. Input any 2 valid URLs, we are not going to consume them at all, so no need to be serious:

      6. You can get the client_id from here:

    2. client_secret
      1. Scroll down to ‘keys’ secition, select duration

      2. Click “Save” at the bottom of the page, and you can see the key from the same location:

    3. tenant_id
      1. Click “View Endpoints” at the bottom of the page:

      2. Find “OAUTH 2.0 AUTHORIZATION ENDPOINT“, and copy the key from the url, you can find it from here:<tenant_id>/oauth2/authorize


Start from a basic resource:

Save the file, and run “terraform plan”:

Plan shows what will “terraform” do if run with “apply” command.

We can do “terraform apply” to get the resource implemented.


Here is the simple resource description for 10 servers & multiple networks:


Have fun~