Skip to content

Commit 162e080

Browse files
committed
fix: improve aws support by renaming gcloud and kubectl variables
1 parent 7ec8593 commit 162e080

File tree

17 files changed

+228
-35
lines changed

17 files changed

+228
-35
lines changed

cloudbuild.yaml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ substitutions:
3636
_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD:
3737
_TEMPLATE_DEFAULT_CONTAINER_REGISTRY:
3838
_TEMPLATE_DEFAULT_KUBERNETES:
39+
_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX:
40+
_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD:
3941
_TEMPLATE_DEFAULT_POSTGRES:
4042

4143
steps:
@@ -76,6 +78,8 @@ steps:
7678
export template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
7779
export template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
7880
export template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
81+
export template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
82+
export template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
7983
export template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
8084
export taito_target_env
8185
taito_target_env="$${branch_name}"
@@ -86,8 +90,8 @@ steps:
8690
source ./taito-config.sh
8791
8892
echo "- Get cluster credentials"
89-
if ! gcloud container clusters get-credentials "$${kubectl_name}" \
90-
--zone "$${gcloud_zone}"; then
93+
if ! gcloud container clusters get-credentials "$${kubernetes_name}" \
94+
--zone "$${taito_provider_zone}"; then
9195
echo "ERROR: Get cluster credentials failed"
9296
exit 1
9397
fi
@@ -133,6 +137,8 @@ steps:
133137
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
134138
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
135139
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
140+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
141+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
136142
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
137143

138144
- id: artifact-prepare
@@ -162,6 +168,8 @@ steps:
162168
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
163169
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
164170
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
171+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
172+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
165173
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
166174

167175
- id: scan
@@ -191,6 +199,8 @@ steps:
191199
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
192200
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
193201
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
202+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
203+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
194204
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
195205

196206
# Build artifacts
@@ -222,6 +232,8 @@ steps:
222232
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
223233
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
224234
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
235+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
236+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
225237
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
226238

227239
- id: artifact-build-admin
@@ -251,6 +263,8 @@ steps:
251263
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
252264
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
253265
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
266+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
267+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
254268
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
255269

256270
- id: artifact-push-admin
@@ -280,6 +294,8 @@ steps:
280294
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
281295
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
282296
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
297+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
298+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
283299
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
284300

285301
- id: artifact-build-client
@@ -309,6 +325,8 @@ steps:
309325
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
310326
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
311327
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
328+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
329+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
312330
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
313331

314332
- id: artifact-push-client
@@ -338,6 +356,8 @@ steps:
338356
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
339357
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
340358
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
359+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
360+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
341361
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
342362

343363
- id: artifact-build-graphql
@@ -367,6 +387,8 @@ steps:
367387
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
368388
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
369389
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
390+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
391+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
370392
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
371393

372394
- id: artifact-push-graphql
@@ -396,6 +418,8 @@ steps:
396418
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
397419
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
398420
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
421+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
422+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
399423
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
400424

401425
- id: artifact-build-server
@@ -425,6 +449,8 @@ steps:
425449
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
426450
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
427451
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
452+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
453+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
428454
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
429455

430456
- id: artifact-push-server
@@ -454,6 +480,8 @@ steps:
454480
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
455481
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
456482
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
483+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
484+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
457485
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
458486

459487
- id: artifact-build-www
@@ -483,6 +511,8 @@ steps:
483511
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
484512
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
485513
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
514+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
515+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
486516
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
487517

488518
- id: artifact-push-www
@@ -512,6 +542,8 @@ steps:
512542
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
513543
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
514544
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
545+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
546+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
515547
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
516548

517549
# Deploy to target environment
@@ -542,6 +574,8 @@ steps:
542574
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
543575
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
544576
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
577+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
578+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
545579
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
546580

547581
- id: deployment-deploy
@@ -570,6 +604,8 @@ steps:
570604
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
571605
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
572606
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
607+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
608+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
573609
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
574610

575611
# Run tests against the target environment
@@ -600,6 +636,8 @@ steps:
600636
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
601637
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
602638
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
639+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
640+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
603641
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
604642

605643
- id: test
@@ -629,6 +667,8 @@ steps:
629667
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
630668
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
631669
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
670+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
671+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
632672
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
633673

634674
- id: deployment-verify
@@ -657,6 +697,8 @@ steps:
657697
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
658698
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
659699
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
700+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
701+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
660702
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
661703

662704
# Publish and release
@@ -687,6 +729,8 @@ steps:
687729
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
688730
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
689731
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
732+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
733+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
690734
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}
691735

692736
- id: artifact-release
@@ -715,4 +759,6 @@ steps:
715759
- template_default_monitoring_uptime_channels_prod=${_TEMPLATE_DEFAULT_MONITORING_UPTIME_CHANNELS_PROD}
716760
- template_default_container_registry=${_TEMPLATE_DEFAULT_CONTAINER_REGISTRY}
717761
- template_default_kubernetes=${_TEMPLATE_DEFAULT_KUBERNETES}
762+
- template_default_kubernetes_cluster_prefix=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX}
763+
- template_default_kubernetes_cluster_prefix_prod=${_TEMPLATE_DEFAULT_KUBERNETES_CLUSTER_PREFIX_PROD}
718764
- template_default_postgres=${_TEMPLATE_DEFAULT_POSTGRES}

scripts/helm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ full-stack:
4848
memoryRequest: 50Mi
4949
memoryLimit: 256Mi
5050
# Scaling
51-
replicas: ${kubectl_replicas}
51+
replicas: ${kubernetes_replicas}
5252
autoscale: false
5353
minReplicas: 2
5454
maxReplicas: 5

scripts/helm/requirements.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dependencies:
22
- name: full-stack
3-
version: 0.2.2
3+
version: 0.2.3
44
repository: https://taitounited.github.io/taito-charts/

scripts/taito-template/init.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
: "${template_default_source_git:?}"
3030
: "${template_default_dest_git:?}"
3131
: "${template_default_kubernetes:?}"
32+
: "${template_default_kubernetes_cluster_prefix:?}"
33+
: "${template_default_kubernetes_cluster_prefix_prod:?}"
3234
: "${template_default_postgres:?}"
3335
: "${template_default_storage_class:?}"
3436

@@ -273,6 +275,10 @@ sed -i "s/\${template_default_dest_git:?}/${template_default_dest_git}/g" taito-
273275
# Kubernetes
274276
sed -i \
275277
"s/\${template_default_kubernetes:?}/${template_default_kubernetes}/g" taito-config.sh
278+
sed -i \
279+
"s/\${template_default_kubernetes_cluster_prefix:?}/${template_default_kubernetes_cluster_prefix}/g" taito-config.sh
280+
sed -i \
281+
"s/\${template_default_kubernetes_cluster_prefix_prod:?}/${template_default_kubernetes_cluster_prefix_prod}/g" taito-config.sh
276282

277283
# Database
278284
sed -i \
@@ -309,6 +315,7 @@ elif [[ "${template_default_provider}" == "aws" ]]; then
309315
sed -i "s/ gcloud:-local/ aws:-local/" taito-config.sh
310316
sed -i "s/ gcloud-storage:-local/ aws-storage:-local/" taito-config.sh
311317
sed -i "s/ gcloud-monitoring:-local//" taito-config.sh
318+
sed -i '/gserviceaccount/d' taito-config.sh
312319
else
313320
echo "ERROR: Unknown provider '${template_default_provider}'"
314321
exit 1
@@ -375,7 +382,7 @@ if [[ $ci == "gcloud" ]]; then
375382
sed -i "s|\${_TEMPLATE_DEFAULT_TAITO_IMAGE}|${template_default_taito_image}|g" cloudbuild.yaml
376383
sed -i '/_TEMPLATE_DEFAULT_/d' cloudbuild.yaml
377384
sed -i '/template_default_taito_image/d' cloudbuild.yaml
378-
sed -i "s|_IMAGE_REGISTRY: eu.gcr.io/\$PROJECT_ID|_IMAGE_REGISTRY: ${template_default_container_registry}/${template_default_zone}|" cloudbuild.yaml
385+
sed -i "s|_IMAGE_REGISTRY: eu.gcr.io/\$PROJECT_ID|_IMAGE_REGISTRY: ${template_default_container_registry}|" cloudbuild.yaml
379386
else
380387
rm -f cloudbuild.yaml
381388
fi
@@ -428,6 +435,7 @@ if [[ "${template_default_git_provider}" != "github.com" ]]; then
428435
echo "Disabling semantic-release for git provider '${template_default_git_provider}'"
429436
echo "TODO: implement semantic-release support for '${template_default_git_provider}'"
430437
sed -i "s/prod\": \"semantic-release/prod\": \"echo DISABLED semantic-release/g" package.json
438+
sed -i '/github-buildbot/d' taito-config.sh
431439
fi
432440

433441
######################

scripts/terraform/aws/main.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
provider "aws" {
2+
region = "${var.taito_provider_region}"
3+
profile = "${coalesce(var.taito_provider_user_profile, var.taito_organization)}"
4+
shared_credentials_file = "/home/taito/.aws/credentials"
5+
}
6+
7+
module "common-aws" {
8+
source = "../common/aws"
9+
10+
taito_env = "${var.taito_env}"
11+
taito_domain = "${var.taito_domain}"
12+
taito_project = "${var.taito_project}"
13+
taito_provider_region = "${var.taito_provider_region}"
14+
taito_organization = "${var.taito_organization}"
15+
taito_vc_repository = "${var.taito_vc_repository}"
16+
taito_provider_user_profile = "${var.taito_provider_user_profile}"
17+
taito_targets = "${var.taito_targets}"
18+
19+
taito_storages = "${var.taito_storages}"
20+
taito_storage_locations = "${var.taito_storage_locations}"
21+
taito_storage_classes = "${var.taito_storage_classes}"
22+
taito_storage_days = "${var.taito_storage_days}"
23+
}

scripts/terraform/aws/variables.tf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
variable "taito_env" {}
2+
variable "taito_domain" {}
3+
variable "taito_project" {}
4+
variable "taito_provider_region" {}
5+
variable "taito_organization" {}
6+
variable "taito_vc_repository" {}
7+
8+
variable "taito_provider_user_profile" {
9+
type = "string"
10+
default = ""
11+
}
12+
13+
variable "taito_targets" {
14+
type = "list"
15+
}
16+
17+
/* Storage */
18+
19+
variable "taito_storages" {
20+
type = "list"
21+
default = []
22+
}
23+
variable "taito_storage_locations" {
24+
type = "list"
25+
default = []
26+
}
27+
variable "taito_storage_classes" {
28+
type = "list"
29+
default = []
30+
}
31+
variable "taito_storage_days" {
32+
type = "list"
33+
default = []
34+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# TODO backup storage buckets
2+
# mfa_delete = true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
provider "aws" {
2+
region = "${var.taito_provider_region}"
3+
profile = "${coalesce(var.taito_provider_user_profile, var.taito_organization)}"
4+
shared_credentials_file = "/home/taito/.aws/credentials"
5+
}
6+
7+
# TODO: create service account for accessing resources
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
resource "aws_ecr_repository" "image" {
2+
count = "${var.taito_env == "dev" ? length(var.taito_targets) : 0}"
3+
name = "${var.taito_vc_repository}/${element(var.taito_targets, count.index)}"
4+
}
5+
6+
resource "aws_ecr_repository" "builder" {
7+
count = "${var.taito_env == "dev" ? length(var.taito_targets) : 0}"
8+
name = "${var.taito_vc_repository}/${element(var.taito_targets, count.index)}-builder"
9+
}

0 commit comments

Comments
 (0)