-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from sixfeetup/nvernooy/92-refactor-duplicates
Nvernooy/92 refactor duplicates
- Loading branch information
Showing
17 changed files
with
114 additions
and
201 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
{{cookiecutter.project_slug}}/terraform/modules/application/cloudfront.tf
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,3 @@ | ||
resource "aws_cloudfront_origin_access_identity" "static_storage" { | ||
comment = "${var.application}-${var.environment}" | ||
} |
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
8 changes: 8 additions & 0 deletions
8
{{cookiecutter.project_slug}}/terraform/modules/application/locals.tf
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,8 @@ | ||
locals { | ||
common_tags = merge(var.tags, { | ||
automation = "terraform" | ||
"automation.config" = join(".", [var.application, var.environment]) | ||
application = var.application | ||
environment = var.environment | ||
}) | ||
} |
12 changes: 12 additions & 0 deletions
12
{{cookiecutter.project_slug}}/terraform/modules/application/outputs.tf
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,12 @@ | ||
output "application_user_access_key" { | ||
value = aws_iam_access_key.application_user_key.id | ||
} | ||
|
||
output "application_user_secret_key" { | ||
sensitive = true | ||
value = aws_iam_access_key.application_user_key.secret | ||
} | ||
|
||
output "static_storage_bucket" { | ||
value = aws_s3_bucket.static_storage.bucket_domain_name | ||
} |
14 changes: 14 additions & 0 deletions
14
{{cookiecutter.project_slug}}/terraform/modules/application/route53.tf
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,14 @@ | ||
|
||
data "aws_route53_zone" "route_zone" { | ||
name = var.domain_zone | ||
} | ||
|
||
# record for calls to cluster | ||
resource "aws_route53_record" "routes" { | ||
for_each = var.domain_urls | ||
zone_id = data.aws_route53_zone.route_zone.zone_id | ||
name = each.value | ||
type = "A" | ||
records = [var.cluster_public_id] | ||
ttl = 600 | ||
} |
4 changes: 2 additions & 2 deletions
4
...er.project_slug}}/terraform/sandbox/s3.tf → ...lug}}/terraform/modules/application/s3.tf
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
25 changes: 25 additions & 0 deletions
25
{{cookiecutter.project_slug}}/terraform/modules/application/variables.tf
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,25 @@ | ||
variable "application" { | ||
default = "{{cookiecutter.project_slug}}" | ||
} | ||
|
||
variable "environment" { | ||
default = "sandbox" | ||
} | ||
|
||
variable "domain_zone" { | ||
default = "{{ cookiecutter.domain_name }}" | ||
} | ||
|
||
variable "domain_urls" { | ||
type = list(string) | ||
default = ["{{ cookiecutter.domain_name }}"] | ||
} | ||
|
||
variable "cluster_public_id" { | ||
default = "" | ||
} | ||
|
||
variable "tags" { | ||
type = map(string) | ||
default = {} | ||
} |
10 changes: 10 additions & 0 deletions
10
{{cookiecutter.project_slug}}/terraform/prod/application.tf
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,10 @@ | ||
# the application module sets up Route53 records to the EC2 cluster and S3 static storage | ||
module "application" { | ||
source = "../modules/application" | ||
|
||
application = module.global_variables.application | ||
environment = var.environment | ||
domain_zone = var.domain | ||
domain_urls = [var.domain, var.api_domain] | ||
cluster_public_id = data.aws_instance.ec2_cluster.public_ip | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
{{cookiecutter.project_slug}}/terraform/sandbox/application.tf
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,10 @@ | ||
# the application module sets up Route53 records to the EC2 cluster and S3 static storage | ||
module "application" { | ||
source = "../modules/application" | ||
|
||
application = module.global_variables.application | ||
environment = var.environment | ||
domain_zone = var.domain | ||
domain_urls = [var.domain, var.api_domain] | ||
cluster_public_id = data.aws_instance.ec2_cluster.public_ip | ||
} |
3 changes: 0 additions & 3 deletions
3
{{cookiecutter.project_slug}}/terraform/sandbox/cloudfront.tf
This file was deleted.
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
22 changes: 0 additions & 22 deletions
22
{{cookiecutter.project_slug}}/terraform/sandbox/route53.tf
This file was deleted.
Oops, something went wrong.