Skip to content

Commit

Permalink
feat: failover instance
Browse files Browse the repository at this point in the history
Planning to get some time to actually look at this during the weekend...
  • Loading branch information
alexander-jackson committed Jan 2, 2025
1 parent 0f2a435 commit 07522f1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions terraform/aws.tf
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ resource "aws_key_pair" "main" {
public_key = file("./keys/id_rsa.pub")
}

module "secondary" {
module "primary" {
source = "./modules/f2-instance"
name = "secondary"
name = "primary"

instance = {
type = "t2.nano"
Expand Down Expand Up @@ -250,13 +250,13 @@ module "database" {
elastic_ip = false
}

resource "aws_security_group_rule" "allow_inbound_connections_from_secondary" {
description = format("Allow inbound connections from %s", module.secondary.security_group_id)
resource "aws_security_group_rule" "allow_inbound_connections_from_primary" {
description = format("Allow inbound connections from %s", module.primary.security_group_id)
type = "ingress"
from_port = 5432
to_port = 5432
protocol = "tcp"
source_security_group_id = module.secondary.security_group_id
source_security_group_id = module.primary.security_group_id
security_group_id = module.database.security_group_id
}

Expand Down Expand Up @@ -297,5 +297,5 @@ resource "aws_route53_record" "records" {
name = each.key
type = "A"
ttl = 300
records = [module.secondary.public_ip]
records = [module.primary.public_ip]
}

0 comments on commit 07522f1

Please sign in to comment.