Skip to content

Commit

Permalink
Fix ssm param name and remove sg
Browse files Browse the repository at this point in the history
  • Loading branch information
ha7315 committed Mar 26, 2024
1 parent 5607816 commit 099c122
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 21 deletions.
2 changes: 1 addition & 1 deletion modules/create-rds-postgres-tester/create_user_task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module "create_user_task" {
# N.B. $DUMP_FILENAME is injected by the Step Function task
override_command = [
"sh", "-c",
"aws ssm get-parameter --name /${var.db_name}/sql_script --query 'Parameter.Value' --output text > /tmp/myfile && psql -d connection_string -f /tmp/myfile"
"aws ssm get-parameter --name ${var.db_name}-postgres-create-tester-user-sql --query 'Parameter.Value' --output text > /tmp/create_tester_user.sql && psql -d connection_string -f /tmp/create_tester_user.sql"
]
port = null
secret_environment_variables = [
Expand Down
4 changes: 2 additions & 2 deletions modules/create-rds-postgres-tester/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "aws_sfn_state_machine" "create_rds_postgres_tester" {

definition = <<EOF
{
"StartAt": "RetrieveSSMParameter",
"StartAt": "CreateUser",
"States": {
"CreateUser": {
"Type": "Task",
Expand All @@ -16,7 +16,7 @@ resource "aws_sfn_state_machine" "create_rds_postgres_tester" {
"NetworkConfiguration": {
"awsvpcConfiguration": {
"Subnets": ["${var.subnet_id}"],
"SecurityGroups": "States.Array('${aws_security_group.ecs_security_group.id}', '${aws_security_group.create_user_task.id}', ${var.db_clients_security_group_id}')",
"SecurityGroups": "States.Array('${var.db_clients_security_group_id}')",
"AssignPublicIp": "ENABLED"
}
},
Expand Down
16 changes: 0 additions & 16 deletions modules/create-rds-postgres-tester/sg.tf

This file was deleted.

4 changes: 2 additions & 2 deletions modules/create-rds-postgres-tester/ssm.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "aws_ssm_parameter" "sql_script" {
name = "/${var.db_name}/sql_script"
resource "aws_ssm_parameter" "postgres-create-tester-user-sql" {
name = "${var.db_name}-postgres-create-tester-user-sql"
description = "SQL script to conditionally create the 'tester' user in the Postgres database"
type = "String"
value = <<EOF
Expand Down

0 comments on commit 099c122

Please sign in to comment.