Skip to content

Commit 695a0a4

Browse files
committed
fix(deployment): inlude region config
1 parent 9ab5419 commit 695a0a4

File tree

11 files changed

+24
-8
lines changed

11 files changed

+24
-8
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ brew install opentofu
3838
tofu -u version
3939
```
4040

41-
The best way to get started with Storoku is to use the [Storoku starter example](./examples/starter).
41+
Then install Storoku
4242

43-
Generally, Storoku deployments are seperated into an app deployment that is specific to the deployment environment (i.e. 'staging', 'prod' or an individual developer deployment) and a shared deployment that covers resources that are shared across environments including several 'dev' resources that would be expensive to replicate for each individual developer.
43+
```terminal
44+
brew install storacha/storoku
45+
```
4446

45-
In general, you will want to copy the files in the starter example to your project, and follow the README for the example to setup your deployment. Most deployment commands are run with `make`. Yes, that `make` get used to Makefiles again (but hopefully you will not have to edit)
47+
# Usage
4648

47-
##

app/variables.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ variable "appState" {
1616
variable "allowed_account_ids" {
1717
description = "account ids used for AWS"
1818
type = list(string)
19-
default = ["505595374361"]
2019
}
2120

2221
variable "private_key" {

cmd/storoku/template/.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
secrets:
4040
aws-account-id: {{"${{ secrets.STAGING_AWS_ACCOUNT_ID }}"}}
4141
aws-region: {{"${{ secrets.STAGING_AWS_REGION }}"}}
42+
region: {{"${{ secrets.STAGING_AWS_REGION }}"}}
4243
private-key: {{"${{ secrets.STAGING_PRIVATE_KEY }}"}}
4344

4445
# apply prod on successful release, plan otherwise
@@ -56,5 +57,6 @@ jobs:
5657
secrets:
5758
aws-account-id: {{"${{ secrets.PROD_AWS_ACCOUNT_ID }}"}}
5859
aws-region: {{"${{ secrets.PROD_AWS_REGION }}"}}
60+
region: {{"${{ secrets.PROD_AWS_REGION }}"}}
5961
private-key: {{"${{ secrets.PROD_PRIVATE_KEY }}"}}
6062

cmd/storoku/template/.github/workflows/terraform.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ env:
3737
TF_VAR_app: {{.App}}
3838
TF_VAR_domain_base: {{.DomainBase}}
3939
TF_VAR_allowed_account_id: {{"${{ secrets.aws-account-id }}"}}
40+
TF_VAR_region: {{"${{ secrets.region }}"}}
4041
DEPLOY_ENV: ci
4142

4243
permissions:

cmd/storoku/template/deploy/.env.terraform.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ TF_VAR_app={{ .App }}
55
TF_VAR_did= # did for your env
66
TF_VAR_private_key= # private_key or your env -- do not commit to repo!
77
TF_VAR_allowed_account_id=505595374361
8+
TF_VAR_region=us-west-2
89
{{if .Cloudflare}}TF_VAR_cloudflare_zone_id=37783d6f032b78cd97ce37ab6fd42848
910
CLOUDFLARE_API_TOKEN= # enter a cloudflare api token{{end}}

cmd/storoku/template/deploy/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ else
77
endif
88
endif
99

10-
ECR_URI=$(TF_VAR_allowed_account_id).dkr.ecr.us-west-2.amazonaws.com
10+
ECR_URI=$(TF_VAR_allowed_account_id).dkr.ecr.$(TF_VAR_region).amazonaws.com
1111
IMAGE_TAG_BASE=$(ECR_URI)/$(TF_VAR_app)-ecr:$(TF_WORKSPACE)
1212

1313
# This is a hack to eval the image tag only when it's a dependency, cause we don't want to set it until docker builds
@@ -29,7 +29,7 @@ eval_env_file: ../.env.production.local
2929

3030
.PHONY: docker-login
3131
docker-login:
32-
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin $(ECR_URI)
32+
aws ecr get-login-password --region $(TF_VAR_region) | docker login --username AWS --password-stdin $(ECR_URI)
3333

3434
.env.terraform:
3535

cmd/storoku/template/deploy/app/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ terraform {
1717

1818
provider "aws" {
1919
allowed_account_ids = [var.allowed_account_id]
20+
region = var.region
2021
default_tags {
2122

2223
tags = {

cmd/storoku/template/deploy/app/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ variable "allowed_account_id" {
88
type = string
99
}
1010

11+
variable "region" {
12+
description = "aws region for all services"
13+
type = string
14+
}
15+
1116
variable "private_key" {
1217
description = "private_key for the peer for this deployment"
1318
type = string

cmd/storoku/template/deploy/shared/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ terraform {
1919

2020
provider "aws" {
2121
allowed_account_ids = [var.allowed_account_id]
22+
region = var.region
2223
default_tags {
2324
tags = {
2425
"Environment" = terraform.workspace

cmd/storoku/template/deploy/shared/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ variable "allowed_account_id" {
88
type = string
99
}
1010

11+
variable "region" {
12+
description = "aws region for all services"
13+
type = string
14+
}
15+
1116
variable "domain_base" {
1217
type = string
1318
default = ""

0 commit comments

Comments
 (0)