Skip to content

Commit 3a08f79

Browse files
committed
fix deploy
1 parent ea481a2 commit 3a08f79

File tree

9 files changed

+97
-102
lines changed

9 files changed

+97
-102
lines changed

.github/workflows/deploy-qa.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ jobs:
130130
- uses: aws-actions/configure-aws-credentials@v4
131131
with:
132132
role-to-assume: arn:aws:iam::427040638965:role/GitHubActionsRole
133-
role-session-name: Core_Dev_Deployment_${{ github.run_id }}
133+
role-session-name: Core_QA_Deployment_${{ github.run_id }}
134134
aws-region: us-east-1
135135

136136
- name: Publish to AWS
137-
run: make deploy_dev
137+
run: make deploy_qa
138138
env:
139139
HUSKY: "0"
140140
VITE_RUN_ENVIRONMENT: dev

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: aws-actions/configure-aws-credentials@v4
1515
with:
1616
role-to-assume: arn:aws:iam::427040638965:role/GitHubActionsRole
17-
role-session-name: Core_Dev_Deployment
17+
role-session-name: Core_QA_Deployment
1818
aws-region: us-east-1
1919

2020
- name: Get AWS Caller Identity

Makefile

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ GIT_HASH := $(shell git rev-parse --short HEAD)
1010

1111
.PHONY: clean
1212

13-
check_account_prod:
14-
ifneq ($(current_aws_account),$(prod_aws_account))
15-
$(error Error: running in account $(current_aws_account), expected account ID $(prod_aws_account))
16-
endif
17-
18-
check_account_dev:
19-
ifneq ($(current_aws_account),$(dev_aws_account))
20-
$(error Error: running in account $(current_aws_account), expected account ID $(dev_aws_account))
21-
endif
22-
2313

2414
clean:
2515
rm -rf .aws-sam
@@ -55,19 +45,19 @@ build: src/
5545
local:
5646
VITE_BUILD_HASH=$(GIT_HASH) yarn run dev
5747

58-
deploy_prod: check_account_prod
48+
deploy_prod:
5949
@echo "Deploying Terraform..."
6050
terraform -chdir=terraform/envs/prod init -lockfile=readonly
61-
terraform -chdir=terraform/envs/qa plan -out=tfplan
51+
terraform -chdir=terraform/envs/prod plan -out=tfplan
6252
terraform -chdir=terraform/envs/prod apply -auto-approve tfplan
63-
rm tfplan
53+
rm terraform/envs/prod/tfplan
6454

65-
deploy_dev: check_account_dev
55+
deploy_qa:
6656
@echo "Deploying Terraform..."
6757
terraform -chdir=terraform/envs/qa init -lockfile=readonly
6858
terraform -chdir=terraform/envs/qa plan -out=tfplan
6959
terraform -chdir=terraform/envs/qa apply -auto-approve tfplan
70-
rm tfplan
60+
rm terraform/envs/qa/tfplan
7161

7262
init_terraform:
7363
terraform -chdir=terraform/envs/qa init

src/api/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
2. Enable Tailscale VPN so you can reach the development database in AWS
66
3. Log into AWS with `aws configure sso` so you can retrieve the AWS secret and configuration.
77
4. `yarn -D`
8-
5. `make check_account_dev` - If this fails make sure that AWS is configured.
98
6. `make local`
109

1110
## Build for AWS Lambda
@@ -16,7 +15,7 @@
1615

1716
1. Get AWS credentials with `aws configure sso`
1817
2. Ensure AWS profile is set to the right account (QA or PROD).
19-
3. Run `make deploy_dev` or `make deploy_prod`.
18+
3. Run `make deploy_qa` or `make deploy_prod`.
2019

2120
## Generating JWT token
2221

terraform/envs/prod/.terraform.lock.hcl

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

terraform/envs/prod/main.tf

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "~> 5.92"
5+
version = "~> 6.7.0"
66
}
77
}
88

@@ -18,7 +18,8 @@ terraform {
1818

1919

2020
provider "aws" {
21-
region = "us-east-1"
21+
allowed_account_ids = ["298118738376"]
22+
region = "us-east-1"
2223
default_tags {
2324
tags = {
2425
project = var.ProjectId
@@ -31,7 +32,11 @@ data "aws_caller_identity" "current" {}
3132
data "aws_region" "current" {}
3233

3334
locals {
34-
bucket_prefix = "${data.aws_caller_identity.current.account_id}-${data.aws_region.current.name}"
35+
bucket_prefix = "${data.aws_caller_identity.current.account_id}-${data.aws_region.current.region}"
36+
queue_arns = {
37+
main = module.sqs_queues.main_queue_arn
38+
sqs = module.sqs_queues.sales_email_queue_arn
39+
}
3540
}
3641

3742
module "sqs_queues" {
@@ -95,7 +100,7 @@ module "frontend" {
95100

96101
resource "aws_lambda_event_source_mapping" "queue_consumer" {
97102
depends_on = [module.lambdas, module.sqs_queues]
98-
for_each = toset([module.sqs_queues.main_queue_arn, module.sqs_queues.sales_email_queue_arn])
103+
for_each = local.queue_arns
99104
batch_size = 5
100105
event_source_arn = each.key
101106
function_name = module.lambdas.core_sqs_consumer_lambda_arn

terraform/envs/qa/.terraform.lock.hcl

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

terraform/envs/qa/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "~> 5.92"
5+
version = "~> 6.7.0"
66
}
77
}
88

@@ -18,7 +18,8 @@ terraform {
1818

1919

2020
provider "aws" {
21-
region = "us-east-1"
21+
allowed_account_ids = ["427040638965"]
22+
region = "us-east-1"
2223
default_tags {
2324
tags = {
2425
project = var.ProjectId
@@ -38,7 +39,7 @@ module "sqs_queues" {
3839
core_sqs_consumer_lambda_name = module.lambdas.core_sqs_consumer_lambda_name
3940
}
4041
locals {
41-
bucket_prefix = "${data.aws_caller_identity.current.account_id}-${data.aws_region.current.name}"
42+
bucket_prefix = "${data.aws_caller_identity.current.account_id}-${data.aws_region.current.region}"
4243
queue_arns = {
4344
main = module.sqs_queues.main_queue_arn
4445
sqs = module.sqs_queues.sales_email_queue_arn
@@ -129,7 +130,7 @@ resource "aws_lambda_event_source_mapping" "queue_consumer" {
129130
depends_on = [module.lambdas, module.sqs_queues]
130131
for_each = local.queue_arns
131132
batch_size = 5
132-
event_source_arn = each.key
133+
event_source_arn = each.value
133134
function_name = module.lambdas.core_sqs_consumer_lambda_arn
134135
function_response_types = ["ReportBatchItemFailures"]
135136
}

0 commit comments

Comments
 (0)