docs: add Terraform certification notes and tasks
This commit is contained in:
45
terraform/012/main.tf
Normal file
45
terraform/012/main.tf
Normal file
@@ -0,0 +1,45 @@
|
||||
# terraform {
|
||||
# required_providers {
|
||||
# aws = {
|
||||
# source = "hashicorp/aws"
|
||||
# version = "~> 6.0"
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
|
||||
# provider "aws" {
|
||||
# region = "us-east-1"
|
||||
# }
|
||||
|
||||
resource "aws_s3_bucket" "datacenter" {
|
||||
bucket = "datacenter-s3-30377"
|
||||
}
|
||||
|
||||
# Re-enable ACLs (default is BucketOwnerEnforced, which disables them)
|
||||
resource "aws_s3_bucket_ownership_controls" "datacenter" {
|
||||
bucket = aws_s3_bucket.datacenter.id
|
||||
rule {
|
||||
object_ownership = "BucketOwnerPreferred"
|
||||
}
|
||||
}
|
||||
|
||||
# Lift the public-access block so a public ACL is allowed
|
||||
resource "aws_s3_bucket_public_access_block" "datacenter" {
|
||||
bucket = aws_s3_bucket.datacenter.id
|
||||
|
||||
block_public_acls = false
|
||||
block_public_policy = false
|
||||
ignore_public_acls = false
|
||||
restrict_public_buckets = false
|
||||
}
|
||||
|
||||
# Now the public ACL will actually take
|
||||
resource "aws_s3_bucket_acl" "datacenter" {
|
||||
bucket = aws_s3_bucket.datacenter.id
|
||||
acl = "public-read"
|
||||
|
||||
depends_on = [
|
||||
aws_s3_bucket_ownership_controls.datacenter,
|
||||
aws_s3_bucket_public_access_block.datacenter,
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user