-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stupid mistake, deleted chapt 2 code but it didn't work anyway
- Loading branch information
Showing
3 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
provider "aws" { | ||
region = "us-east-2" | ||
} | ||
|
||
resource "aws_s3_bucket" "terraform_state" { | ||
bucket = "hazzardr-terraform-up-and-running-state" | ||
|
||
# so we don't accidentally delete remote state with a destroy command | ||
lifecycle { | ||
prevent_destroy = true | ||
} | ||
} | ||
|
||
resource "aws_s3_bucket_versioning" "enabled" { | ||
bucket = aws_s3_bucket.terraform_state.id | ||
versioning_configuration { | ||
status = "Enabled" | ||
} | ||
} | ||
|
||
resource "aws_s3_bucket_server_side_encryption_configuration" "default" { | ||
bucket = aws_s3_bucket.terraform_state.id | ||
rule { | ||
apply_server_side_encryption_by_default { | ||
sse_algorithm = "AES256" | ||
} | ||
} | ||
} | ||
|
||
# Not technically necessary since buckets are private by default. But, this stops us | ||
# from accidentally making it public later (will have pw etc in it) | ||
resource "aws_s3_bucket_public_access_block" "public_access" { | ||
bucket = aws_s3_bucket.terraform_state.id | ||
|
||
block_public_acls = true | ||
block_public_policy = true | ||
ignore_public_acls = true | ||
restrict_public_buckets = true | ||
} | ||
|
||
resource "aws_dynamodb_table" "terraform_locks" { | ||
name = "terraform-up-and-running-locks" | ||
billing_mode = "PAY_PER_REQUEST" | ||
hash_key = "LockID" | ||
attribute { | ||
name = "LockID" | ||
type = "S" | ||
} | ||
} |