DEV Community

leroykayanda
leroykayanda

Posted on

Initial set up for Terraform Cloud

  • Install terraform

https://learn.hashicorp.com/tutorials/terraform/install-cli

  • Install this vscode extension.

Image description

  • Open a terraform cloud account. Create a workspace with a VCS workflow.

  • Set up a simple script to launch an EC2 instance.

https://github.com/hashicorp/tfc-guide-example

  • Use this in the terraform block.
terraform {

  backend "remote" {
    hostname     = "app.terraform.io"
    organization = "org-name"

    workspaces {
      name = "workspace_name"
    }
  }

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.4.0"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode
  • Log in to terraform cloud terraform login

  • Run terraform init

  • Commit to your repo to trigger an apply

Top comments (0)