|
| 1 | +terraform { |
| 2 | + required_providers { |
| 3 | + aws = { |
| 4 | + source = "hashicorp/aws" |
| 5 | + version = "~> 3.0" |
| 6 | + } |
| 7 | + } |
| 8 | +} |
| 9 | + |
1 | 10 | locals {
|
2 | 11 | configuration = templatefile(
|
3 | 12 | "${path.module}/templates/configuration.hcl.tpl",
|
4 | 13 | {
|
5 | 14 | # Database URL for PostgreSQL
|
6 | 15 | database_url = format(
|
7 | 16 | "postgresql://%s:%s@%s/%s",
|
8 |
| - module.postgresql.this_db_instance_username, |
9 |
| - module.postgresql.this_db_instance_password, |
10 |
| - module.postgresql.this_db_instance_endpoint, |
11 |
| - module.postgresql.this_db_instance_name |
| 17 | + module.postgresql.db_instance_username, |
| 18 | + module.postgresql.db_instance_password, |
| 19 | + module.postgresql.db_instance_endpoint, |
| 20 | + module.postgresql.db_instance_name |
12 | 21 | )
|
13 | 22 |
|
14 | 23 | keys = [
|
@@ -80,7 +89,7 @@ resource "aws_security_group_rule" "ssh" {
|
80 | 89 | from_port = 22
|
81 | 90 | protocol = "TCP"
|
82 | 91 | security_group_id = aws_security_group.controller.id
|
83 |
| - source_security_group_id = join("", aws_security_group.bastion[*].id) |
| 92 | + source_security_group_id = one(aws_security_group.bastion[*].id) |
84 | 93 | to_port = 22
|
85 | 94 | type = "ingress"
|
86 | 95 | }
|
@@ -116,7 +125,8 @@ resource "aws_security_group" "postgresql" {
|
116 | 125 | }
|
117 | 126 |
|
118 | 127 | module "alb" {
|
119 |
| - source = "terraform-aws-modules/alb/aws" |
| 128 | + source = "terraform-aws-modules/alb/aws" |
| 129 | + version = "~> 6.5" |
120 | 130 |
|
121 | 131 | http_tcp_listeners = [
|
122 | 132 | {
|
@@ -148,7 +158,8 @@ resource "random_password" "postgresql" {
|
148 | 158 | }
|
149 | 159 |
|
150 | 160 | module "postgresql" {
|
151 |
| - source = "terraform-aws-modules/rds/aws" |
| 161 | + source = "terraform-aws-modules/rds/aws" |
| 162 | + version = "~> 3.4" |
152 | 163 |
|
153 | 164 | allocated_storage = 5
|
154 | 165 | backup_retention_period = 0
|
@@ -321,5 +332,5 @@ resource "aws_instance" "bastion" {
|
321 | 332 | key_name = var.key_name
|
322 | 333 | subnet_id = var.public_subnets[0]
|
323 | 334 | tags = merge(var.tags, { Name = "Boundary Bastion" })
|
324 |
| - vpc_security_group_ids = [join("", aws_security_group.bastion[*].id)] |
| 335 | + vpc_security_group_ids = [one(aws_security_group.bastion[*].id)] |
325 | 336 | }
|
0 commit comments