Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: support aws 4.0 #83

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,16 @@ resource "aws_ecs_service" "wordpress_service" {
#tfsec:ignore:AWS090
resource "aws_ecs_cluster" "wordpress_cluster" {
name = "${var.site_name}_wordpress"
}

resource "aws_ecs_cluster_capacity_providers" "example" {
cluster_name = aws_ecs_cluster.wordpress_cluster.name

capacity_providers = ["FARGATE_SPOT"]

default_capacity_provider_strategy {
base = 1
weight = 100
capacity_provider = "FARGATE_SPOT"
weight = "100"
base = "1"
}
}
13 changes: 8 additions & 5 deletions modules/cloudfront/distribution.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
resource "aws_s3_bucket" "wordpress_bucket" {
bucket = "${var.site_prefix}.${var.site_domain}"
force_destroy = true
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}

resource "aws_s3_bucket_server_side_encryption_configuration" "wordpress_bucket" {
bucket = aws_s3_bucket.wordpress_bucket.id

rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
Expand Down
23 changes: 15 additions & 8 deletions modules/codebuild/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ data "aws_region" "current" {}
#tfsec:ignore:AWS002 #tfsec:ignore:AWS077
resource "aws_s3_bucket" "code_source" {
bucket = var.codebuild_bucket
acl = "private"
force_destroy = true
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}

resource "aws_s3_bucket_acl" "example_bucket_acl" {
bucket = aws_s3_bucket.code_source.id
acl = "private"
}

resource "aws_s3_bucket_server_side_encryption_configuration" "code_source" {
bucket = aws_s3_bucket.code_source.id

rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
Expand Down Expand Up @@ -55,7 +62,7 @@ resource "aws_iam_role_policy_attachment" "codebuild_role_attachment" {
policy_arn = "arn:aws:iam::aws:policy/PowerUserAccess"
}

resource "aws_s3_bucket_object" "wordpress_dockerbuild" {
resource "aws_s3_object" "wordpress_dockerbuild" {
bucket = aws_s3_bucket.code_source.id
key = "wordpress_docker.zip"
source = "${path.module}/codebuild_files/wordpress_docker.zip"
Expand Down Expand Up @@ -133,7 +140,7 @@ resource "aws_codebuild_project" "wordpress_docker_build" {

source {
type = "S3"
location = "${aws_s3_bucket.code_source.id}/${aws_s3_bucket_object.wordpress_dockerbuild.id}"
location = "${aws_s3_bucket.code_source.id}/${aws_s3_object.wordpress_dockerbuild.id}"

}
}
Expand Down
2 changes: 1 addition & 1 deletion provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
aws = {
source = "hashicorp/aws"
# https://github.com/hashicorp/terraform-provider-aws/blob/main/CHANGELOG.md
version = "~> 3.0"
version = "~> 4.0"
configuration_aliases = [aws.ue1]
}
random = {
Expand Down
2 changes: 1 addition & 1 deletion rds.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ resource "aws_rds_cluster" "serverless_wordpress" {
db_subnet_group_name = aws_db_subnet_group.main_vpc.name
cluster_identifier = "${var.site_name}-serverless-wordpress"
engine = "aurora-mysql"
engine_version = "5.7.mysql_aurora.2.07.1"
engine_version = "5.7"
engine_mode = "serverless"
database_name = "wordpress"
master_username = "wp_master"
Expand Down