Terraform for AWS
Simple example. How to create bucket in AWS with terraform.
info
For this example I've used default preconfigured aws client, as result there is no additional aws configuration in main.tf file.
main.tf
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = "eu-central-1"
}
resource "aws_s3_bucket" "example-bucket" {
bucket = "example-bucket"
}
and use following commands for validate and apply new aws configuration
# Initialize modules
$ terraftm init
# validate configuration
$ terraftm validate
# create aws resources
$ terraftm apply