Skip to content

Instantly share code, notes, and snippets.

# Do not change the order of these default values. it will force the build to destory and rebuid
variable "s3_bucket_names" {
type = list
default = ["bucket1.app",
"bucket2.app",
"bucket3.app"
]
}
@paulycloud
paulycloud / terraform_s3_buckets.tf
Created January 10, 2020 04:21
Terraform | Create multiple S3 buckets with Terraform
# Configure the AWS Provider
provider "aws" {
access_key = var.aws_access_key
secret_key = var.aws_secret_key
region = var.aws_region
}
/*--------------------------------------------------
* S3 Buckets
* The resource block will create all the buckets in the variable array
s3_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
s3_secret: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
s3_bucket: mysite.com
image: cgswong/aws
pipelines:
branches:
master:
- step:
script:
- aws s3 --region "us-east-1" sync public/ s3://mysite.com --cache-control "public, max-age=14400" --delete