Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TM-865 Adding in build for TST and PRE #9375

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
"old_mail_server_url": "mail.aws.dev.legalservices.gov.uk"
},
"test": {
"example_var": "test-data"
"env_short": "uat",
"smtp_ami_id": "ami-07c2c2bf769d5174d",
"smtp_instance_type": "t2.large",
"old_mail_server_url": "mail.aws.uat.legalservices.gov.uk"
},
"preproduction": {
"example_var": "preproduction-data"
"env_short": "stg",
"smtp_ami_id": "ami-07c2c2bf769d5174d",
"smtp_instance_type": "t2.large",
"old_mail_server_url": "mail.aws.stg.legalservices.gov.uk"
},
"production": {
"env_short": "prod",
Expand Down
4 changes: 2 additions & 2 deletions terraform/environments/laa-mail-relay/ses.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ resource "aws_secretsmanager_secret_version" "smtp_password" {
}

resource "aws_secretsmanager_secret" "smtp_sesans" {
name = "postfix/app/SESANS"
name = "postfix/app/SESANS_MP"
description = "Secret to pull from Ansible code from https://github.com/ministryofjustice/laa-aws-postfix-smtp"
tags = merge(
local.tags,
{ "Name" = "postfix/app/SESANS" }
{ "Name" = "postfix/app/SESANS_MP" }
)
}

Expand Down
8 changes: 6 additions & 2 deletions terraform/environments/laa-mail-relay/smtp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ mkdir -p /root/ansible
echo "Getting secrets from Secrets Manager"
export SESP=`/usr/local/bin/aws --region eu-west-2 secretsmanager get-secret-value --secret-id postfix/app/APP_DATA_MIGRATION_SMTP_PASSWORD --query SecretString --output text`
export SESU=`/usr/local/bin/aws --region eu-west-2 secretsmanager get-secret-value --secret-id postfix/app/APP_DATA_MIGRATION_SMTP_USER --query SecretString --output text`
export SESANS=`/usr/local/bin/aws --region eu-west-2 secretsmanager get-secret-value --secret-id postfix/app/SESANS --query SecretString --output text`
export SESANS=`/usr/local/bin/aws --region eu-west-2 secretsmanager get-secret-value --secret-id postfix/app/SESANS_MP --query SecretString --output text`
# mkdir -p /run/cfn-init # Path to store cfn-init scripts

echo "Running Ansible Pull"
ansible-pull -U https://$SESANS@github.com/ministryofjustice/laa-aws-postfix-smtp aws/app/ansible/adhoc.yml -C modernisation-platform -i aws/app/ansible/inventory/$ENV --limit=smtp --extra-vars "smtp_user_name=${aws_iam_access_key.smtp.id} smtp_user_pass=${aws_iam_access_key.smtp.ses_smtp_password_v4}" -d /root/ansible | tail -n +3
ansible-pull -U https://$SESANS@github.com/ministryofjustice/laa-aws-postfix-smtp aws/app/ansible/adhoc.yml -C modernisation-platform -i aws/app/ansible/inventory/$ENV --limit=smtp --extra-vars "smtp_user_name=$SESU smtp_user_pass=$SESP" -d /root/ansible | tail -n +3

EOF
}
Expand Down Expand Up @@ -62,6 +62,10 @@ resource "aws_instance" "smtp" {
local.tags,
{ "Name" = "${local.application_name}-${local.environment}" }
)

depends_on = [
aws_secretsmanager_secret_version.smtp_user, aws_secretsmanager_secret_version.smtp_password
]
}

#################################
Expand Down
Loading