Skip to content

Commit

Permalink
Merge pull request #13 from amavrogiannis/revert-12-feature/add-stagi…
Browse files Browse the repository at this point in the history
…ng-cfront

Revert "adding cfn staging policy"
  • Loading branch information
amavrogiannis authored Nov 26, 2023
2 parents ea073c4 + 80753b6 commit 0df6eea
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 292 deletions.
8 changes: 4 additions & 4 deletions infra/envs/prod/backend.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ terraform {

provider "aws" {
# alias = "main"
region = "eu-west-1"
region = "eu-west-1"
# profile = var.PROFILE
default_tags {
tags = {
Terraform = "TRUE"
Terraform = "TRUE"
}
}
}

provider "aws" {
alias = "virginia"
region = "us-east-1"
alias = "virginia"
region = "us-east-1"
# profile = var.PROFILE_US
}
14 changes: 4 additions & 10 deletions infra/envs/prod/modules.tf
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
module "cvalexmav_web" {
source = "../../modules/web"

primary_domain_certificate = "alexmav.co.uk"

// Staging website
bucket_name = "cv.alexmav.co.uk"
enable_website = true

enable_website = true

# Tags
service_group = "CV_Website"
environment = "Production"

// Staging webstie
enable_staging_cloudfront = true
staging_domain = "test.alexmav.co.uk"
// Tags
environment_test = "Development"

providers = {
aws.virginia = aws.virginia
}
Expand Down
10 changes: 5 additions & 5 deletions infra/envs/test/backend.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ terraform {
}

provider "aws" {

region = "eu-west-1"
# alias = "main"
region = "eu-west-1"
# profile = var.PROFILE
default_tags {
tags = {
Terraform = "TRUE"
Terraform = "TRUE"
}
}
}

provider "aws" {
alias = "virginia"
region = "us-east-1"
alias = "virginia"
region = "us-east-1"
# profile = var.PROFILE_US
}
25 changes: 11 additions & 14 deletions infra/envs/test/modules.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# module "testalexmav_web" {
# source = "../../modules/web"
module "testalexmav_web" {
source = "../../modules/web"

# bucket_name = "test.alexmav.co.uk"
bucket_name = "test.alexmav.co.uk"

# enable_website = true
enable_website = true

# enable_staging_cloudfront = false
# staging_cloudfront_id = null
# Tags
service_group = "Test_Website"
environment = "Development"

# # Tags
# service_group = "Test_Website"
# environment = "Development"

# providers = {
# aws.virginia = aws.virginia
# }
# }
providers = {
aws.virginia = aws.virginia
}
}
1 change: 1 addition & 0 deletions infra/envs/test/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
#############################################################

### Sys environments ###
# variable "REGION" {}
# variable "PROFILE" {}
# variable "PROFILE_US" {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ data "aws_acm_certificate" "this" {
}

resource "aws_cloudfront_origin_access_identity" "this" {
comment = var.comments
comment = var.comments
}

resource "aws_cloudfront_distribution" "this" {
enabled = true

continuous_deployment_policy_id = aws_cloudfront_continuous_deployment_policy.cdn_policy.id

origin {
domain_name = aws_s3_bucket.this.bucket_regional_domain_name
origin_id = local.s3_origin_id
Expand All @@ -21,6 +17,7 @@ resource "aws_cloudfront_distribution" "this" {
origin_access_identity = aws_cloudfront_origin_access_identity.this.cloudfront_access_identity_path
}
}
enabled = true
is_ipv6_enabled = true
comment = var.comments
default_root_object = "index.html"
Expand Down Expand Up @@ -98,12 +95,7 @@ resource "aws_cloudfront_distribution" "this" {
]
}
}
tags = merge(
local.tags,
{
Environment = "${var.environment}"
}
)
tags = local.tags

#First, create certificate, before pasting the ARN here.
viewer_certificate {
Expand Down
15 changes: 9 additions & 6 deletions infra/modules/web/s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
############## S3 Bucket Config #############################
#############################################################

locals {
tags = {
Environment = "${var.environment}"
Service_Group = "${var.service_group}"
}
s3_origin_id = "Application"
}

resource "aws_s3_bucket" "this" {
bucket = var.bucket_name
tags = merge(
local.tags,
{
Environment = "${var.environment}"
}
)
tags = local.tags
}

resource "aws_s3_bucket_ownership_controls" "this" {
Expand Down
88 changes: 0 additions & 88 deletions infra/modules/web/s3_staging.tf

This file was deleted.

131 changes: 0 additions & 131 deletions infra/modules/web/staging_cloudfront.tf

This file was deleted.

Loading

0 comments on commit 0df6eea

Please sign in to comment.