Skip to content

Commit 6b814cb

Browse files
rootroot
authored andcommitted
set names
1 parent 302e5ff commit 6b814cb

File tree

9 files changed

+66
-66
lines changed

9 files changed

+66
-66
lines changed

README.md

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ Your output should be similar to the one below:
113113

114114
Run the following command in terminal:
115115
```shell
116-
terrahub component -t google_storage_bucket -n demo_storage_bucket \
117-
&& terrahub component -t google_cloudfunctions_function -n demo_function -o ../demo_storage_bucket
116+
terrahub component -t google_storage_bucket -n google_storage \
117+
&& terrahub component -t google_cloudfunctions_function -n google_function -o ../google_storage
118118
```
119119

120120
Your output should be similar to the one below:
@@ -141,12 +141,12 @@ Your output should be similar to the one below:
141141

142142
Run the following command in terminal:
143143
```shell
144-
terrahub configure -i demo_storage_bucket -c component.template.terraform.backend.local.path='/tmp/.terrahub/local_backend/demo_storage_bucket/terraform.tfstate'
145-
terrahub configure -i demo_storage_bucket -c component.template.resource.google_storage_bucket.demo_storage_bucket.name='demo_storage_bucket_99999999'
146-
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'
148-
terrahub configure -i demo_storage_bucket -c component.template.resource.google_storage_bucket.demo_storage_bucket.project='${local.google_project_id}'
149-
terrahub configure -i demo_storage_bucket -c component.template.variable -D -y
144+
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.location='US'
147+
terrahub configure -i google_storage -c component.template.resource.google_storage_bucket.google_storage.force_destroy='true'
148+
terrahub configure -i google_storage -c component.template.resource.google_storage_bucket.google_storage.project='${local.google_project_id}'
149+
terrahub configure -i google_storage -c component.template.variable -D -y
150150
```
151151

152152
Your output should be similar to the one below:
@@ -158,48 +158,48 @@ Your output should be similar to the one below:
158158

159159
Run the following command in terminal:
160160
```shell
161-
terrahub configure -i demo_function -c component.template.terraform.backend.local.path='/tmp/.terrahub/local_backend/demo_function/terraform.tfstate'
162-
terrahub configure -i demo_function -c component.template.data.terraform_remote_state.storage.backend='local'
163-
terrahub configure -i demo_function -c component.template.data.terraform_remote_state.storage.config.path='/tmp/.terrahub/local_backend/demo_storage_bucket/terraform.tfstate'
164-
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}'
166-
terrahub configure -i demo_function -c component.template.resource.google_storage_bucket_object.demo_object.source='./demo.zip'
167-
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.depends_on[0]='google_storage_bucket_object.demo_object'
168-
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.name='demofunction${local.project["code"]}'
169-
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.region='us-central1'
170-
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.runtime='nodejs8'
171-
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.description='My demo function'
172-
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.available_memory_mb=128
173-
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.source_archive_bucket='${data.terraform_remote_state.storage.thub_id}'
174-
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.source_archive_object='${google_storage_bucket_object.demo_object.name}'
175-
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.trigger_http=true
176-
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.timeout=60
177-
terrahub configure -i demo_function -c component.template.resource.google_cloudfunctions_function.demo_function.entry_point='helloGET'
178-
terrahub configure -i demo_function -c component.template.variable -D -y
179-
terrahub configure -i demo_function -c component.template.output -D -y
180-
terrahub configure -i demo_function -c component.template.output.id.value='${google_cloudfunctions_function.demo_function.id}'
181-
terrahub configure -i demo_function -c component.template.output.trigger_url.value='${google_cloudfunctions_function.demo_function.https_trigger_url}'
182-
terrahub configure -i demo_function -c build.env.variables.THUB_FUNCTION_ZIP='demo.zip'
183-
terrahub configure -i demo_function -c build.env.variables.THUB_FUNCTION_TXT='demo.txt'
184-
terrahub configure -i demo_function -c build.env.variables.COMPONENT_NAME='demo_function'
185-
terrahub configure -i demo_function -c build.env.variables.OBJECT_NAME='demo_object'
186-
terrahub configure -i demo_function -c build.env.variables.THUB_BUILD_PATH='..'
187-
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_99999999'
189-
terrahub configure -i demo_function -c build.env.variables.THUB_BUCKET_KEY='deploy/demo_function'
190-
terrahub configure -i demo_function -c build.phases.pre_build.commands[0]='echo "BUILD: Running pre_build step"'
191-
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'
192-
terrahub configure -i demo_function -c build.phases.pre_build.commands[2]='./scripts/compare.sh $THUB_FUNCTION_TXT $THUB_BUILD_PATH/*.js'
193-
terrahub configure -i demo_function -c build.phases.pre_build.finally[0]='echo "BUILD: pre_build step successful"'
194-
terrahub configure -i demo_function -c build.phases.build.commands[0]='echo "BUILD: Running build step"'
195-
terrahub configure -i demo_function -c build.phases.build.commands[1]='./scripts/build.sh $COMPONENT_NAME $OBJECT_NAME $THUB_BUCKET_KEY/'
196-
terrahub configure -i demo_function -c build.phases.build.finally[0]='echo "BUILD: build step successful"'
197-
terrahub configure -i demo_function -c build.phases.post_build.commands[0]='echo "BUILD: Running post_build step"'
198-
terrahub configure -i demo_function -c build.phases.post_build.commands[1]='./scripts/shasum.sh $THUB_FUNCTION_TXT'
199-
terrahub configure -i demo_function -c build.phases.post_build.commands[2]='./scripts/zip.sh $THUB_FUNCTION_ZIP $THUB_BUILD_PATH/*.js'
200-
terrahub configure -i demo_function -c build.phases.post_build.commands[3]='./scripts/upload.sh $THUB_FUNCTION_TXT $THUB_BUCKET_PATH/$THUB_BUCKET_KEY/$THUB_FUNCTION_TXT'
201-
terrahub configure -i demo_function -c build.phases.post_build.commands[4]='rm -f .terrahub_build.env $THUB_FUNCTION_TXT'
202-
terrahub configure -i demo_function -c build.phases.post_build.finally[0]='echo "BUILD: post_build step successful"'
161+
terrahub configure -i google_function -c component.template.terraform.backend.local.path='/tmp/.terrahub/local_backend/google_function/terraform.tfstate'
162+
terrahub configure -i google_function -c component.template.data.terraform_remote_state.storage.backend='local'
163+
terrahub configure -i google_function -c component.template.data.terraform_remote_state.storage.config.path='/tmp/.terrahub/local_backend/google_storage/terraform.tfstate'
164+
terrahub configure -i google_function -c component.template.resource.google_storage_bucket_object.google_storage_object.name='demo.zip'
165+
terrahub configure -i google_function -c component.template.resource.google_storage_bucket_object.google_storage_object.bucket='${data.terraform_remote_state.storage.thub_id}'
166+
terrahub configure -i google_function -c component.template.resource.google_storage_bucket_object.google_storage_object.source='./demo.zip'
167+
terrahub configure -i google_function -c component.template.resource.google_cloudfunctions_function.google_function.depends_on[0]='google_storage_bucket_object.google_storage_object'
168+
terrahub configure -i google_function -c component.template.resource.google_cloudfunctions_function.google_function.name='demofunction${local.project["code"]}'
169+
terrahub configure -i google_function -c component.template.resource.google_cloudfunctions_function.google_function.region='us-central1'
170+
terrahub configure -i google_function -c component.template.resource.google_cloudfunctions_function.google_function.runtime='nodejs8'
171+
terrahub configure -i google_function -c component.template.resource.google_cloudfunctions_function.google_function.description='My demo function'
172+
terrahub configure -i google_function -c component.template.resource.google_cloudfunctions_function.google_function.available_memory_mb=128
173+
terrahub configure -i google_function -c component.template.resource.google_cloudfunctions_function.google_function.source_archive_bucket='${data.terraform_remote_state.storage.thub_id}'
174+
terrahub configure -i google_function -c component.template.resource.google_cloudfunctions_function.google_function.source_archive_object='${google_storage_bucket_object.google_storage_object.name}'
175+
terrahub configure -i google_function -c component.template.resource.google_cloudfunctions_function.google_function.trigger_http=true
176+
terrahub configure -i google_function -c component.template.resource.google_cloudfunctions_function.google_function.timeout=60
177+
terrahub configure -i google_function -c component.template.resource.google_cloudfunctions_function.google_function.entry_point='helloGET'
178+
terrahub configure -i google_function -c component.template.variable -D -y
179+
terrahub configure -i google_function -c component.template.output -D -y
180+
terrahub configure -i google_function -c component.template.output.id.value='${google_cloudfunctions_function.google_function.id}'
181+
terrahub configure -i google_function -c component.template.output.trigger_url.value='${google_cloudfunctions_function.google_function.https_trigger_url}'
182+
terrahub configure -i google_function -c build.env.variables.THUB_FUNCTION_ZIP='demo.zip'
183+
terrahub configure -i google_function -c build.env.variables.THUB_FUNCTION_TXT='demo.txt'
184+
terrahub configure -i google_function -c build.env.variables.COMPONENT_NAME='google_function'
185+
terrahub configure -i google_function -c build.env.variables.OBJECT_NAME='google_storage_object'
186+
terrahub configure -i google_function -c build.env.variables.THUB_BUILD_PATH='..'
187+
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_KEY='deploy/google_function'
190+
terrahub configure -i google_function -c build.phases.pre_build.commands[0]='echo "BUILD: Running pre_build step"'
191+
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'
192+
terrahub configure -i google_function -c build.phases.pre_build.commands[2]='./scripts/compare.sh $THUB_FUNCTION_TXT $THUB_BUILD_PATH/*.js'
193+
terrahub configure -i google_function -c build.phases.pre_build.finally[0]='echo "BUILD: pre_build step successful"'
194+
terrahub configure -i google_function -c build.phases.build.commands[0]='echo "BUILD: Running build step"'
195+
terrahub configure -i google_function -c build.phases.build.commands[1]='./scripts/build.sh $COMPONENT_NAME $OBJECT_NAME $THUB_BUCKET_KEY/'
196+
terrahub configure -i google_function -c build.phases.build.finally[0]='echo "BUILD: build step successful"'
197+
terrahub configure -i google_function -c build.phases.post_build.commands[0]='echo "BUILD: Running post_build step"'
198+
terrahub configure -i google_function -c build.phases.post_build.commands[1]='./scripts/shasum.sh $THUB_FUNCTION_TXT'
199+
terrahub configure -i google_function -c build.phases.post_build.commands[2]='./scripts/zip.sh $THUB_FUNCTION_ZIP $THUB_BUILD_PATH/*.js'
200+
terrahub configure -i google_function -c build.phases.post_build.commands[3]='./scripts/upload.sh $THUB_FUNCTION_TXT $THUB_BUCKET_PATH/$THUB_BUCKET_KEY/$THUB_FUNCTION_TXT'
201+
terrahub configure -i google_function -c build.phases.post_build.commands[4]='rm -f .terrahub_build.env $THUB_FUNCTION_TXT'
202+
terrahub configure -i google_function -c build.phases.post_build.finally[0]='echo "BUILD: post_build step successful"'
203203
```
204204

205205
Your output should be similar to the one below:
@@ -217,17 +217,17 @@ terrahub graph
217217
Your output should be similar to the one below:
218218
```
219219
Project: demo-terraform-automation-google
220-
└─ demo_storage_bucket_7b3c5d2c [path: ./demo_storage_bucket_7b3c5d2c]
221-
└─ demo_function_7b3c5d2c [path: ./demo_function_7b3c5d2c]
220+
└─ google_storage_7b3c5d2c [path: ./google_storage_7b3c5d2c]
221+
└─ google_function_7b3c5d2c [path: ./google_function_7b3c5d2c]
222222
```
223223

224224

225225
## Run TerraHub Automation
226226

227227
Run the following command in terminal:
228228
```shell
229-
terrahub run -a -y -i demo_storage_bucket
230-
terrahub build -i demo_function
229+
terrahub run -a -y -i google_storage
230+
terrahub build -i google_function
231231
terrahub run -a -y
232232
```
233233

demo_function/.terrahub.yml renamed to google_function/.terrahub.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
component:
2-
name: demo_function
2+
name: google_function
33
mapping:
44
- .
55
dependsOn:
@@ -8,7 +8,7 @@ component:
88
terraform:
99
backend:
1010
local:
11-
path: /tmp/.terrahub/local_backend/demo_function/terraform.tfstate
11+
path: /tmp/.terrahub/local_backend/google_function/terraform.tfstate
1212
data:
1313
terraform_remote_state:
1414
storage:
@@ -17,40 +17,40 @@ component:
1717
path: /tmp/.terrahub/local_backend/demo_storage_bucket/terraform.tfstate
1818
resource:
1919
google_storage_bucket_object:
20-
demo_object:
21-
name: deploy/demo_function/1551790491.zip
20+
google_storage_object:
21+
name: deploy/google_function/1551790491.zip
2222
bucket: '${data.terraform_remote_state.storage.thub_id}'
2323
source: ./demo.zip
2424
google_cloudfunctions_function:
25-
demo_function:
25+
google_function:
2626
depends_on:
27-
- google_storage_bucket_object.demo_object
27+
- google_storage_bucket_object.google_storage_object
2828
name: 'demofunction${local.project["code"]}'
2929
region: us-central1
3030
runtime: nodejs8
3131
description: My demo function
3232
available_memory_mb: 128
3333
source_archive_bucket: '${data.terraform_remote_state.storage.thub_id}'
34-
source_archive_object: '${google_storage_bucket_object.demo_object.name}'
34+
source_archive_object: '${google_storage_bucket_object.google_storage_object.name}'
3535
trigger_http: true
3636
timeout: 60
3737
entry_point: helloGET
3838
output:
3939
id:
40-
value: '${google_cloudfunctions_function.demo_function.id}'
40+
value: '${google_cloudfunctions_function.google_function.id}'
4141
trigger_url:
42-
value: '${google_cloudfunctions_function.demo_function.https_trigger_url}'
42+
value: '${google_cloudfunctions_function.google_function.https_trigger_url}'
4343
build:
4444
env:
4545
variables:
4646
THUB_FUNCTION_ZIP: demo.zip
4747
THUB_FUNCTION_TXT: demo.txt
48-
COMPONENT_NAME: demo_function
49-
OBJECT_NAME: demo_object
48+
COMPONENT_NAME: google_function
49+
OBJECT_NAME: google_storage_object
5050
THUB_BUILD_PATH: ..
5151
THUB_BUILD_OK: false
5252
THUB_BUCKET_PATH: 'gs://demo_storage_bucket_99999999'
53-
THUB_BUCKET_KEY: deploy/demo_function
53+
THUB_BUCKET_KEY: deploy/google_function
5454
phases:
5555
pre_build:
5656
commands:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)