-
Notifications
You must be signed in to change notification settings - Fork 17
/
first_build.yaml
100 lines (93 loc) · 2.15 KB
/
first_build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
steps:
- id: "build and push first docker image"
name: "gcr.io/cloud-builders/gcloud"
args: ["builds", "submit", "--tag", "gcr.io/$PROJECT_ID/dash-cloudrun-demo"]
- id: "download encrypted secrets only during build"
name: "gcr.io/cloud-builders/gsutil"
args:
[
"cp",
"gs://$PROJECT_ID-secure-bucket-secrets/ciphertext_file.enc",
"ciphertext_file.enc",
]
- id: "decrypt secrets only during build"
name: "gcr.io/cloud-builders/gcloud"
args:
[
"kms",
"decrypt",
"--ciphertext-file",
"ciphertext_file.enc",
"--plaintext-file",
"service_account.json",
"--location",
"global",
"--keyring",
"$PROJECT_ID-keyring",
"--key",
"$PROJECT_ID-key",
]
###############################################
# deploy terraform infrastructure
- id: "tf init"
name: "hashicorp/terraform:0.12.9"
entrypoint: "sh"
args:
- "-c"
- |
cd tf_modules/
terraform init
# [START tf-plan]
- id: "tf plan"
name: "hashicorp/terraform:0.12.9"
entrypoint: "sh"
args:
- "-c"
- |
cd tf_modules/
terraform plan
# [END tf-plan]
# [START tf-apply]
- id: "tf apply"
name: "hashicorp/terraform:0.12.9"
entrypoint: "sh"
args:
- "-c"
- |
cd tf_modules/
terraform apply -auto-approve
# [END tf-apply]
- id: "allow cloud run unauthenticated"
name: "gcr.io/cloud-builders/gcloud"
args:
[
"beta",
"run",
"services",
"add-iam-policy-binding",
"tf-dash-cloud-run-demo",
"--member",
"allUsers",
"--region",
"us-central1",
"--role",
"roles/run.invoker",
"--platform",
"managed",
]
- id: "upgrade container memory limit"
name: "gcr.io/cloud-builders/gcloud"
args:
[
"beta",
"run",
"services",
"update",
"tf-dash-cloud-run-demo",
"--memory",
"1Gi",
"--region",
"us-central1",
"--platform",
"managed",
]