Skip to content

Instantly share code, notes, and snippets.

import json
import sys
import boto3
import os
from botocore.exceptions import ClientError
ec2 = boto3.client('ec2')
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}
# Configure the AWS Provider
provider "aws" {
provider "aws" {
region = "us-east-1"
}
data "aws_vpc" "default" {
default = true
}
#Retrieve the list of AZs in the current AWS region
data "aws_availability_zones" "available" {}
resource "aws_s3_bucket" "s3_bucket" {
bucket = var.bucket_name
tags = var.tags
}
resource "aws_s3_bucket_public_access_block" "s3_bucket_public_access_block"{
bucket = aws_s3_bucket.s3_bucket.id
block_public_acls = false