This is a newbie who just discovered Terraform & other HCP tools and feeling the excitement I’ve felt for a long time.
But kinda need a little hand-holding with below.
Say you have this (following the beginner’s tutorials):
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 2.70"
}
}
}
provider "aws" {
profile = "default"
region = "us-west-2"
}
resource "aws_instance" "example" {
ami = "ami-08d70e59c07c61a3a"
instance_type = "t2.micro"
}
and want to use Terraform Cloud for remote state management.
Where do you add this block:
terraform {
backend "remote" {
organization = "<ORG_NAME>"
workspaces {
name = "Example-Workspace"
}
}
}
To the same .tf file as below:
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 2.70"
}
}
}
terraform {
backend "remote" {
organization = "<ORG_NAME>"
workspaces {
name = "Example-Workspace"
}
}
}
provider "aws" {
profile = "default"
region = "us-west-2"
}
resource "aws_instance" "example" {
ami = "ami-08d70e59c07c61a3a"
instance_type = "t2.micro"
}
or
terraform {
backend "remote" {
organization = "<ORG_NAME>"
workspaces {
name = "Example-Workspace"
}
}
}
provider "aws" {
profile = "default"
region = "us-west-2"
}
resource "aws_instance" "example" {
ami = "ami-08d70e59c07c61a3a"
instance_type = "t2.micro"
}
Thanks for your guidance.