1
1
# Terraform Automation Demo using Google Cloud Provider
2
2
3
+ The purpose of this repository is to show case terraform automation for Google
4
+ Cloud. This demo will provision the following cloud resources associated to
5
+ corresponding terraform configurations:
6
+
7
+ | GCP Resource | Terraform Resource | Link to TerraHub Config |
8
+ | -----------------------| --------------------| -------------------------|
9
+ | Cloud Function | google_cloudfunctions_function | https://github.com/TerraHubCorp/demo-terraform-automation-gcp/blob/master/google_function/.terrahub.yml#L24 |
10
+ | Cloud Storage | google_storage_bucket | https://github.com/TerraHubCorp/demo-terraform-automation-gcp/blob/master/google_storage/.terrahub.yml#L7 |
11
+ | Static Website | google_storage_bucket_object | https://github.com/TerraHubCorp/demo-terraform-automation-gcp/blob/master/google_function/.terrahub.yml#L19 |
12
+ | IAM Policy | iam_member_object_viewer | https://github.com/TerraHubCorp/demo-terraform-automation-gcp/blob/master/google_storage/.terrahub.yml#L7 |
13
+
14
+ Follow below instructions to try this out in your own Google Cloud account.
15
+
3
16
## Login to Google Cloud
4
17
5
18
Run the following command in terminal:
@@ -116,7 +129,12 @@ bindings:
116
129
version: 1
117
130
```
118
131
119
- ## Create Terraform Configurations Using TerraHub
132
+ ## Terraform Automation and Orchestration Tool
133
+
134
+ The next couple of paragraphs are show casing the process of creating terraform
135
+ configurations using [ TerraHub CLI] ( https://github.com/TerraHubCorp/terrahub ) .
136
+ We have opted to use YML format instead of HCL because it's easier and faster
137
+ to customize and automate terraform runs (see ` terrahub component ` command).
120
138
121
139
Run the following commands in terminal:
122
140
``` shell
@@ -133,6 +151,8 @@ terrahub@0.0.1 (built: 2018-04-07T19:15:39.787Z)
133
151
> NOTE: If you don't have TerraHub CLI, check out this
134
152
[ installation guide] ( https://www.npmjs.com/package/terrahub )
135
153
154
+ ## Build Terraform Configurations
155
+
136
156
Run the following commands in terminal:
137
157
``` shell
138
158
mkdir demo-terraform-automation-gcp
@@ -145,6 +165,13 @@ Your output should be similar to the one below:
145
165
✅ Project successfully initialized
146
166
```
147
167
168
+ > NOTE: If you want to jump directly to terraform automation part of the demo,
169
+ instead of creating ` demo-terraform-automation-gcp ` from scratch, clone current
170
+ repository, follow the instructions for `Copy Source Code for Google Function
171
+ and Static Website` , after jump to ` Update Project Config` and skip down to
172
+ ` Visualize TerraHub Components ` . This way you will fast forward through terrahub
173
+ components creation and customization, and switch directly to the automation part.
174
+
148
175
## Copy Source Code for Google Function and Static Website
149
176
150
177
The source code of Google Function is stored in ` index.js ` :
@@ -342,7 +369,7 @@ Project: demo-terraform-automation-gcp
342
369
343
370
Run the following command in terminal:
344
371
``` shell
345
- terrahub run -a -y -i google_storage,google_static_website
372
+ terrahub run -y -a -i google_storage,google_static_website
346
373
```
347
374
348
375
Your output should be similar to the one below:
@@ -365,7 +392,7 @@ Your output should be similar to the one below:
365
392
366
393
Run the following command in terminal:
367
394
``` shell
368
- terrahub run -a -y
395
+ terrahub run -y -a
369
396
```
370
397
371
398
Your output should be similar to the one below:
0 commit comments