Skip to content

Commit 1c08e40

Browse files
rootroot
authored andcommitted
used environment variables
1 parent 3006b31 commit 1c08e40

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export BILLING_ID="" ## e.g. 123456-ABCDEF-ZYXWVU
2020
export PROJECT_NAME="" ## e.g. TerraHub
2121
export IAM_NAME="" ## e.g. terraform
2222
export IAM_DESC="" ## e.g. terraform service account
23+
export GOOGLE_STORAGE_BUCKET="" ## e.g. terrahub_bucket_123456
2324
```
2425
### Setup BILLING_ID Programmatically
2526

@@ -142,7 +143,7 @@ Your output should be similar to the one below:
142143
Run the following command in terminal:
143144
```shell
144145
terrahub configure -i google_storage -c component.template.terraform.backend.local.path='/tmp/.terrahub/local_backend/google_storage/terraform.tfstate'
145-
terrahub configure -i google_storage -c component.template.resource.google_storage_bucket.google_storage.name='google_storage_99999999'
146+
terrahub configure -i google_storage -c component.template.resource.google_storage_bucket.google_storage.name="${GOOGLE_STORAGE_BUCKET}"
146147
terrahub configure -i google_storage -c component.template.resource.google_storage_bucket.google_storage.location='US'
147148
terrahub configure -i google_storage -c component.template.resource.google_storage_bucket.google_storage.force_destroy='true'
148149
terrahub configure -i google_storage -c component.template.resource.google_storage_bucket.google_storage.project='${local.google_project_id}'
@@ -185,7 +186,7 @@ terrahub configure -i google_function -c build.env.variables.COMPONENT_NAME='goo
185186
terrahub configure -i google_function -c build.env.variables.OBJECT_NAME='google_storage_object'
186187
terrahub configure -i google_function -c build.env.variables.THUB_BUILD_PATH='..'
187188
terrahub configure -i google_function -c build.env.variables.THUB_BUILD_OK='false'
188-
terrahub configure -i google_function -c build.env.variables.THUB_BUCKET_PATH='gs://google_storage_99999999'
189+
terrahub configure -i google_function -c build.env.variables.THUB_BUCKET_PATH="gs://${GOOGLE_STORAGE_BUCKET}"
189190
terrahub configure -i google_function -c build.env.variables.THUB_BUCKET_KEY='deploy/google_function'
190191
terrahub configure -i google_function -c build.phases.pre_build.commands[0]='echo "BUILD: Running pre_build step"'
191192
terrahub configure -i google_function -c build.phases.pre_build.commands[1]='./scripts/download.sh $THUB_FUNCTION_TXT $THUB_BUCKET_PATH/$THUB_BUCKET_KEY/$THUB_FUNCTION_TXT'

google_function/.terrahub.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ component:
1414
storage:
1515
backend: local
1616
config:
17-
path: /tmp/.terrahub/local_backend/demo_storage_bucket/terraform.tfstate
17+
path: /tmp/.terrahub/local_backend/google_storage/terraform.tfstate
1818
resource:
1919
google_storage_bucket_object:
2020
google_storage_object:
21-
name: deploy/google_function/1551790491.zip
21+
name: demo.zip
2222
bucket: '${data.terraform_remote_state.storage.thub_id}'
2323
source: ./demo.zip
2424
google_cloudfunctions_function:
@@ -49,7 +49,7 @@ build:
4949
OBJECT_NAME: google_storage_object
5050
THUB_BUILD_PATH: ..
5151
THUB_BUILD_OK: false
52-
THUB_BUCKET_PATH: 'gs://demo_storage_bucket_99999999'
52+
THUB_BUCKET_PATH: 'gs://terrahub_bucket_123456'
5353
THUB_BUCKET_KEY: deploy/google_function
5454
phases:
5555
pre_build:

google_storage/.terrahub.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
component:
2-
name: demo_storage_bucket
2+
name: google_storage
33
mapping:
44
- .
55
template:
66
resource:
77
google_storage_bucket:
8-
demo_storage_bucket:
9-
name: demo_storage_bucket_99999999
8+
google_storage:
9+
name: terrahub_bucket_123456
1010
location: US
1111
force_destroy: true
1212
project: '${local.google_project_id}'
1313
output:
1414
id:
15-
value: '${google_storage_bucket.demo_storage_bucket.id}'
15+
value: '${google_storage_bucket.google_storage.id}'
1616
thub_id:
17-
value: '${google_storage_bucket.demo_storage_bucket.id}'
17+
value: '${google_storage_bucket.google_storage.id}'
1818
self_link:
19-
value: '${google_storage_bucket.demo_storage_bucket.self_link}'
19+
value: '${google_storage_bucket.google_storage.self_link}'
2020
project:
21-
value: '${google_storage_bucket.demo_storage_bucket.project}'
21+
value: '${google_storage_bucket.google_storage.project}'
2222
url:
23-
value: '${google_storage_bucket.demo_storage_bucket.url}'
23+
value: '${google_storage_bucket.google_storage.url}'
2424
terraform:
2525
backend:
2626
local:
27-
path: /tmp/.terrahub/local_backend/demo_storage_bucket/terraform.tfstate
27+
path: /tmp/.terrahub/local_backend/google_storage/terraform.tfstate

0 commit comments

Comments
 (0)