Skip to content

Commit

Permalink
Converting dev destroy to individual jobs (#1468)
Browse files Browse the repository at this point in the history
Dev environment destroy fixes!
  • Loading branch information
ben851 authored Aug 23, 2024
1 parent e79b9f7 commit a3a380e
Show file tree
Hide file tree
Showing 44 changed files with 1,970 additions and 183 deletions.
653 changes: 653 additions & 0 deletions .github/workflows/terragrunt_create_dev_environment.yml

Large diffs are not rendered by default.

700 changes: 597 additions & 103 deletions .github/workflows/terragrunt_destroy_environment.yml

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions aws/dns/notification.cdssandbox.xyz.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
resource "aws_route53_zone" "notification-sandbox" {
count = var.env == "production" ? 0 : 1
count = var.env == "staging" ? 1 : 0
name = "notification.cdssandbox.xyz"
}

resource "aws_route53_record" "notification-sandbox-MX" {
count = var.env == "production" ? 0 : 1
provider = aws.dns
zone_id = aws_route53_zone.notification-sandbox[0].zone_id
zone_id = var.env == "staging" ? aws_route53_zone.notification-sandbox[0].zone_id : var.hosted_zone_id
name = var.domain
type = "MX"
ttl = "300"
Expand All @@ -16,7 +16,7 @@ resource "aws_route53_record" "notification-sandbox-MX" {
resource "aws_route53_record" "bounce-notification-sandbox-MX" {
count = var.env == "production" ? 0 : 1
provider = aws.dns
zone_id = aws_route53_zone.notification-sandbox[0].zone_id
zone_id = var.env == "staging" ? aws_route53_zone.notification-sandbox[0].zone_id : var.hosted_zone_id
name = "bounce.${var.domain}"
type = "MX"
ttl = "300"
Expand All @@ -26,7 +26,7 @@ resource "aws_route53_record" "bounce-notification-sandbox-MX" {
resource "aws_route53_record" "bounce-custom-notification-sandbox-MX" {
count = var.env == "production" ? 0 : 1
provider = aws.dns
zone_id = aws_route53_zone.notification-sandbox[0].zone_id
zone_id = var.env == "staging" ? aws_route53_zone.notification-sandbox[0].zone_id : var.hosted_zone_id
name = "bounce.custom-sending-domain.${var.domain}"
type = "MX"
ttl = "300"
Expand All @@ -36,7 +36,7 @@ resource "aws_route53_record" "bounce-custom-notification-sandbox-MX" {
resource "aws_route53_record" "ses-notification-sandbox-TXT" {
count = var.env == "production" ? 0 : 1
provider = aws.dns
zone_id = aws_route53_zone.notification-sandbox[0].zone_id
zone_id = var.env == "staging" ? aws_route53_zone.notification-sandbox[0].zone_id : var.hosted_zone_id
name = "_amazonses.${var.domain}"
type = "TXT"
ttl = "300"
Expand All @@ -48,7 +48,7 @@ resource "aws_route53_record" "ses-notification-sandbox-TXT" {
resource "aws_route53_record" "dmarc-notification-sandbox-TXT" {
count = var.env == "production" ? 0 : 1
provider = aws.dns
zone_id = aws_route53_zone.notification-sandbox[0].zone_id
zone_id = var.env == "staging" ? aws_route53_zone.notification-sandbox[0].zone_id : var.hosted_zone_id
name = "_dmarc.${var.domain}"
type = "TXT"
ttl = "300"
Expand All @@ -58,7 +58,7 @@ resource "aws_route53_record" "dmarc-notification-sandbox-TXT" {
resource "aws_route53_record" "notification-sandbox-TXT" {
count = var.env == "production" ? 0 : 1
provider = aws.dns
zone_id = aws_route53_zone.notification-sandbox[0].zone_id
zone_id = var.env == "staging" ? aws_route53_zone.notification-sandbox[0].zone_id : var.hosted_zone_id
name = var.domain
type = "TXT"
ttl = "300"
Expand All @@ -70,7 +70,7 @@ resource "aws_route53_record" "notification-sandbox-TXT" {
resource "aws_route53_record" "bounce-notification-sandbox-TXT" {
count = var.env == "production" ? 0 : 1
provider = aws.dns
zone_id = aws_route53_zone.notification-sandbox[0].zone_id
zone_id = var.env == "staging" ? aws_route53_zone.notification-sandbox[0].zone_id : var.hosted_zone_id
name = "bounce.${var.domain}"
type = "TXT"
ttl = "300"
Expand All @@ -79,7 +79,7 @@ resource "aws_route53_record" "bounce-notification-sandbox-TXT" {

resource "aws_route53_record" "custom-domain-aws-ses-sandbox-TXT" {
count = var.env == "production" ? 0 : 1
zone_id = aws_route53_zone.notification-sandbox[0].zone_id
zone_id = var.env == "staging" ? aws_route53_zone.notification-sandbox[0].zone_id : var.hosted_zone_id
provider = aws.dns
name = "_amazonses.custom-sending-domain.${var.domain}"
type = "TXT"
Expand All @@ -90,7 +90,7 @@ resource "aws_route53_record" "custom-domain-aws-ses-sandbox-TXT" {
resource "aws_route53_record" "custom-domain-ses-sandbox-TXT" {
count = var.env == "production" ? 0 : 1
provider = aws.dns
zone_id = aws_route53_zone.notification-sandbox[0].zone_id
zone_id = var.env == "staging" ? aws_route53_zone.notification-sandbox[0].zone_id : var.hosted_zone_id
name = "custom-sending-domain.${var.domain}"
type = "TXT"
ttl = "300"
Expand Down
2 changes: 1 addition & 1 deletion aws/dns/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ output "internal_dns_name" {
}

output "route53_zone_id" {
value = var.env == "production" ? aws_route53_zone.notification-canada-ca[0].zone_id : aws_route53_zone.notification-sandbox[0].zone_id
value = var.env == "production" ? aws_route53_zone.notification-canada-ca[0].zone_id : var.env == "staging" ? aws_route53_zone.notification-sandbox[0].zone_id : var.hosted_zone_id
}
6 changes: 4 additions & 2 deletions aws/dns/secrets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ resource "aws_secretsmanager_secret_version" "internal_dns_cert_base64" {
}

resource "aws_secretsmanager_secret" "internal_dns_key_base64" {
name = "INTERNAL_DNS_KEY_BASE64"
name = "INTERNAL_DNS_KEY_BASE64"
recovery_window_in_days = 0
}

resource "aws_secretsmanager_secret_version" "internal_dns_key_base64" {
Expand All @@ -18,7 +19,8 @@ resource "aws_secretsmanager_secret_version" "internal_dns_key_base64" {
}

resource "aws_secretsmanager_secret" "internal_dns_fqdn" {
name = "INTERNAL_DNS_FQDN"
name = "INTERNAL_DNS_FQDN"
recovery_window_in_days = 0
}

resource "aws_secretsmanager_secret_version" "internal_dns_fqdn" {
Expand Down
6 changes: 6 additions & 0 deletions aws/dns/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ variable "scratch_account_ids" {
variable "vpc_id" {
type = string
description = "Used to associate the internal DNS with the VPC"
}

variable "hosted_zone_id" {
type = string
description = "Used to associate the internal DNS with the VPC"
default = "Z04028033PLSHVOO9ZJ1Z"
}
2 changes: 1 addition & 1 deletion aws/eks/sentinel.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module "sentinel_forwarder" {
function_name = "sentinel-cloud-watch-forwarder"
billing_tag_value = "notification-canada-ca-${var.env}"

layer_arn = "arn:aws:lambda:ca-central-1:283582579564:layer:aws-sentinel-connector-layer:132"
layer_arn = "arn:aws:lambda:ca-central-1:283582579564:layer:aws-sentinel-connector-layer:150"

customer_id = var.sentinel_customer_id
shared_key = var.sentinel_shared_key
Expand Down
9 changes: 1 addition & 8 deletions aws/lambda-api/secrets_manager.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
resource "random_string" "new_relic_postfix" {
count = var.env == "production" || var.env == "staging" ? 0 : 1

length = 8
special = false
}

resource "aws_secretsmanager_secret" "new-relic-license-key" {
name = var.env == "production" || var.env == "staging" ? "NEW_RELIC_LICENSE_KEY" : "NEW_RELIC_LICENSE_KEY_${random_string.new_relic_postfix[0].result}"
name = "NEW_RELIC_LICENSE_KEY"
description = "The New Relic license key, for sending telemetry"
recovery_window_in_days = 0
}
Expand Down
Loading

0 comments on commit a3a380e

Please sign in to comment.