Skip to content

Commit

Permalink
Clean up bluegreen stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
stwalkerster committed Jan 12, 2025
1 parent 65144f6 commit bfdcd70
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 69 deletions.
39 changes: 3 additions & 36 deletions app.tf
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
locals {
blue_resource_prefix = "${var.resource_prefix}-appserver-b"
green_resource_prefix = "${var.resource_prefix}-appserver-g"
}

module "bluegreen" {
source = "github.com/enwikipedia-acc/terraform-openstack-bluegreen?ref=0.2.0"

blue_dns_name = "${local.blue_resource_prefix}.${data.openstack_dns_zone_v2.rootzone.name}"
green_dns_name = "${local.green_resource_prefix}.${data.openstack_dns_zone_v2.rootzone.name}"
live_environment = var.live_instance
staging_environment = var.staging_instance
}

module "application-blue" {
source = "github.com/enwikipedia-acc/terraform-openstack-waca-application?ref=0.1.0"

count = module.bluegreen.blue_count
count = 1

dns_name = module.bluegreen.blue_dns_name
resource_prefix = local.blue_resource_prefix
dns_name = "${var.resource_prefix}-appserver-b.${data.openstack_dns_zone_v2.rootzone.name}"
resource_prefix = "${var.resource_prefix}-appserver-b"
environment = "blue"
instance_type = data.openstack_compute_flavor_v2.small.id
network = data.openstack_networking_network_v2.network.id
Expand All @@ -30,22 +16,3 @@ module "application-blue" {
openstack_networking_secgroup_v2.app.name,
]
}

module "application-green" {
source = "github.com/enwikipedia-acc/terraform-openstack-waca-application"

count = module.bluegreen.green_count

dns_name = module.bluegreen.green_dns_name
resource_prefix = local.green_resource_prefix
environment = "green"
instance_type = data.openstack_compute_flavor_v2.small.id
network = data.openstack_networking_network_v2.network.id
dns_zone_id = data.openstack_dns_zone_v2.rootzone.id
image_name = "debian-11.0-bullseye"

security_groups = [
data.openstack_networking_secgroup_v2.default.name,
openstack_networking_secgroup_v2.app.name,
]
}
18 changes: 1 addition & 17 deletions dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "openstack_dns_recordset_v2" "prod_app" {
name = "app-prod.${data.openstack_dns_zone_v2.rootzone.name}"
zone_id = data.openstack_dns_zone_v2.rootzone.id
type = "CNAME"
records = [module.bluegreen.live_dns_name]
records = ["app-legacy.${data.openstack_dns_zone_v2.rootzone.name}"]
ttl = 180
}

Expand Down Expand Up @@ -31,19 +31,3 @@ resource "cloudvps_web_proxy" "application_proxy_dev" {
backends = ["http://app-prod.${trimsuffix(data.openstack_dns_zone_v2.rootzone.name, ".")}:80"]
}

resource "cloudvps_web_proxy" "staging_proxy" {
count = module.bluegreen.staging_count

hostname = local.staging_proxy_hostname
domain = var.proxy_domain
backends = ["http://${trimsuffix(module.bluegreen.staging_dns_name, ".")}:80"]
}


resource "cloudvps_web_proxy" "staging_proxy_dev" {
count = module.bluegreen.staging_count

hostname = "${local.staging_proxy_hostname}-dev"
domain = var.proxy_domain
backends = ["http://${trimsuffix(module.bluegreen.staging_dns_name, ".")}:80"]
}
5 changes: 0 additions & 5 deletions environments.auto.tfvars

This file was deleted.

11 changes: 0 additions & 11 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@ variable "resource_prefix" {
default = "accounts"
}

# blue/green deployments
variable "live_instance" {
type = string
description = "The currently-active instance of the application"
}

variable "staging_instance" {
type = string
description = "The instance of the application running as a staging environment"
}

# Proxies
variable "proxy_domain" {
type = string
Expand Down

0 comments on commit bfdcd70

Please sign in to comment.