Skip to content

Commit 302e5ff

Browse files
rootroot
authored andcommitted
fix build function
1 parent 4c7b17c commit 302e5ff

File tree

11 files changed

+29
-230
lines changed

11 files changed

+29
-230
lines changed

.terrahub.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ template:
1515
provider:
1616
google: {}
1717
locals:
18-
google_project_id: terrahub-demo-f2754a99
18+
google_project_id: terrahub-123456
1919
google_billing_account: 123456-ABCDEF-ZYXWVU

README.md

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ Your output should be similar to the one below:
114114
Run the following command in terminal:
115115
```shell
116116
terrahub component -t google_storage_bucket -n demo_storage_bucket \
117-
&& terrahub component -t google_cloudfunctions_function -n demo_function -o ../demo_storage_bucket \
118-
&& terrahub component -t google_storage_bucket -n demo_www -o ../demo_storage_bucket
117+
&& terrahub component -t google_cloudfunctions_function -n demo_function -o ../demo_storage_bucket
119118
```
120119

121120
Your output should be similar to the one below:
@@ -143,8 +142,9 @@ Your output should be similar to the one below:
143142
Run the following command in terminal:
144143
```shell
145144
terrahub configure -i demo_storage_bucket -c component.template.terraform.backend.local.path='/tmp/.terrahub/local_backend/demo_storage_bucket/terraform.tfstate'
146-
terrahub configure -i demo_storage_bucket -c component.template.resource.google_storage_bucket.demo_storage_bucket.name='demo_storage_bucket_a123456b'
145+
terrahub configure -i demo_storage_bucket -c component.template.resource.google_storage_bucket.demo_storage_bucket.name='demo_storage_bucket_99999999'
147146
terrahub configure -i demo_storage_bucket -c component.template.resource.google_storage_bucket.demo_storage_bucket.location='US'
147+
terrahub configure -i demo_storage_bucket -c component.template.resource.google_storage_bucket.demo_storage_bucket.force_destroy='true'
148148
terrahub configure -i demo_storage_bucket -c component.template.resource.google_storage_bucket.demo_storage_bucket.project='${local.google_project_id}'
149149
terrahub configure -i demo_storage_bucket -c component.template.variable -D -y
150150
```
@@ -162,7 +162,7 @@ terrahub configure -i demo_function -c component.template.terraform.backend.loca
162162
terrahub configure -i demo_function -c component.template.data.terraform_remote_state.storage.backend='local'
163163
terrahub configure -i demo_function -c component.template.data.terraform_remote_state.storage.config.path='/tmp/.terrahub/local_backend/demo_storage_bucket/terraform.tfstate'
164164
terrahub configure -i demo_function -c component.template.resource.google_storage_bucket_object.demo_object.name='demo.zip'
165-
terrahub configure -i demo_function -c component.template.resource.google_storage_bucket_object.demo_object.bucket='${data.terraform_remote_state.storage.thub_id}/deploy/demo_function'
165+
terrahub configure -i demo_function -c component.template.resource.google_storage_bucket_object.demo_object.bucket='${data.terraform_remote_state.storage.thub_id}'
166166
terrahub configure -i demo_function -c component.template.resource.google_storage_bucket_object.demo_object.source='./demo.zip'
167167
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.depends_on[0]='google_storage_bucket_object.demo_object'
168168
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.name='demofunction${local.project["code"]}'
@@ -185,8 +185,8 @@ terrahub configure -i demo_function -c build.env.variables.COMPONENT_NAME='demo_
185185
terrahub configure -i demo_function -c build.env.variables.OBJECT_NAME='demo_object'
186186
terrahub configure -i demo_function -c build.env.variables.THUB_BUILD_PATH='..'
187187
terrahub configure -i demo_function -c build.env.variables.THUB_BUILD_OK='false'
188-
terrahub configure -i demo_function -c build.env.variables.THUB_BUCKET_PATH='gs://demo_storage_bucket_a123456b'
189-
terrahub configure -i demo_function -c build.env.variables.THUB_BUCKET_KEY: 'deploy/demo_function'
188+
terrahub configure -i demo_function -c build.env.variables.THUB_BUCKET_PATH='gs://demo_storage_bucket_99999999'
189+
terrahub configure -i demo_function -c build.env.variables.THUB_BUCKET_KEY='deploy/demo_function'
190190
terrahub configure -i demo_function -c build.phases.pre_build.commands[0]='echo "BUILD: Running pre_build step"'
191191
terrahub configure -i demo_function -c build.phases.pre_build.commands[1]='./scripts/download.sh $THUB_FUNCTION_TXT $THUB_BUCKET_PATH/$THUB_BUCKET_KEY/$THUB_FUNCTION_TXT'
192192
terrahub configure -i demo_function -c build.phases.pre_build.commands[2]='./scripts/compare.sh $THUB_FUNCTION_TXT $THUB_BUILD_PATH/*.js'
@@ -207,19 +207,6 @@ Your output should be similar to the one below:
207207
✅ Done
208208
```
209209

210-
## Customize TerraHub Component for Frontend
211-
212-
Run the following command in terminal:
213-
```shell
214-
terrahub configure -i demo_www -c component.template.terraform.backend.local.path='/tmp/.terrahub/local_backend/demo_www/terraform.tfstate'
215-
216-
```
217-
218-
Your output should be similar to the one below:
219-
```
220-
✅ Done
221-
```
222-
223210
## Visualize TerraHub Components
224211

225212
Run the following command in terminal:
@@ -239,8 +226,8 @@ Project: demo-terraform-automation-google
239226

240227
Run the following command in terminal:
241228
```shell
242-
terrahub run -a -y -i demo_storage
243-
terrahub build -i demo_function,demo_www
229+
terrahub run -a -y -i demo_storage_bucket
230+
terrahub build -i demo_function
244231
terrahub run -a -y
245232
```
246233

demo_function/.terrahub.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,27 @@ component:
55
dependsOn:
66
- ../demo_storage_bucket
77
template:
8+
terraform:
9+
backend:
10+
local:
11+
path: /tmp/.terrahub/local_backend/demo_function/terraform.tfstate
12+
data:
13+
terraform_remote_state:
14+
storage:
15+
backend: local
16+
config:
17+
path: /tmp/.terrahub/local_backend/demo_storage_bucket/terraform.tfstate
818
resource:
19+
google_storage_bucket_object:
20+
demo_object:
21+
name: deploy/demo_function/1551790491.zip
22+
bucket: '${data.terraform_remote_state.storage.thub_id}'
23+
source: ./demo.zip
924
google_cloudfunctions_function:
1025
demo_function:
11-
name: 'demofunction${local.project["code"]}'
1226
depends_on:
1327
- google_storage_bucket_object.demo_object
28+
name: 'demofunction${local.project["code"]}'
1429
region: us-central1
1530
runtime: nodejs8
1631
description: My demo function
@@ -20,21 +35,6 @@ component:
2035
trigger_http: true
2136
timeout: 60
2237
entry_point: helloGET
23-
google_storage_bucket_object:
24-
demo_object:
25-
name: deploy/demo_function/1551778012.zip
26-
bucket: '${data.terraform_remote_state.storage.thub_id}'
27-
source: ./demo.zip
28-
terraform:
29-
backend:
30-
local:
31-
path: /tmp/.terrahub/local_backend/demo_function/terraform.tfstate
32-
data:
33-
terraform_remote_state:
34-
storage:
35-
backend: local
36-
config:
37-
path: /tmp/.terrahub/local_backend/demo_storage_bucket/terraform.tfstate
3838
output:
3939
id:
4040
value: '${google_cloudfunctions_function.demo_function.id}'
@@ -48,8 +48,8 @@ build:
4848
COMPONENT_NAME: demo_function
4949
OBJECT_NAME: demo_object
5050
THUB_BUILD_PATH: ..
51-
THUB_BUILD_OK: 'false'
52-
THUB_BUCKET_PATH: 'gs://demo_storage_bucket_7b3c5d2c'
51+
THUB_BUILD_OK: false
52+
THUB_BUCKET_PATH: 'gs://demo_storage_bucket_99999999'
5353
THUB_BUCKET_KEY: deploy/demo_function
5454
phases:
5555
pre_build:

demo_function/demo.zip

-233 Bytes
Binary file not shown.

demo_storage_bucket/.terrahub.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ component:
66
resource:
77
google_storage_bucket:
88
demo_storage_bucket:
9-
name: 'demo_storage_bucket_${local.project["code"]}'
9+
name: demo_storage_bucket_99999999
1010
location: US
11+
force_destroy: true
1112
project: '${local.google_project_id}'
12-
force_destroy: 'true'
1313
output:
1414
id:
1515
value: '${google_storage_bucket.demo_storage_bucket.id}'

demo_www/.terrahub.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

demo_www/scripts/compare.sh

Lines changed: 0 additions & 44 deletions
This file was deleted.

demo_www/scripts/download.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

demo_www/scripts/shasum.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

demo_www/scripts/upload.sh

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)