03-basics: Fix deprecation warnings and postgres version error (#12)

This change updates the s3 bucket resource syntax to use the newer
resource types for specifying versioning and encryption configs.
We also enable auto_minor_version_upgrade for the RDS instance and
switch to only asking for major version 12.

This will just use the default/latest RDS PostgreSQL v12 minor
version. Upside, the specific engine_version provided here will take
longer before it becomes invalid. Minor downside, we are saying its
OK for this RDS instance to undergo minor version upgrades, which
while fine for a toy example like this, is often not great in prod.
This commit is contained in:
Lachlan Mulcahy
2022-09-06 16:53:38 -07:00
committed by GitHub
parent 4012eec6cd
commit 7a3fdaca72
2 changed files with 40 additions and 25 deletions

View File

@@ -27,15 +27,20 @@ provider "aws" {
resource "aws_s3_bucket" "terraform_state" {
bucket = "devops-directive-tf-state" # REPLACE WITH YOUR BUCKET NAME
force_destroy = true
versioning {
enabled = true
}
}
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
resource "aws_s3_bucket_versioning" "terraform_bucket_versioning" {
bucket = aws_s3_bucket.terraform_state.id
versioning_configuration {
status = "Enabled"
}
}
resource "aws_s3_bucket_server_side_encryption_configuration" "terraform_state_crypto_conf" {
bucket = aws_s3_bucket.terraform_state.bucket
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}