@@ -10,19 +10,21 @@ This example creates an instance with a custom machine type, a bastion host and
10
10
11
11
## Install Terraform
12
12
13
- Install Terraform if it is not already installed (visit [ terraform.io] ( https://terraform.io ) for other distributions):
13
+ 1 . Install Terraform if it is not already installed (visit [ terraform.io] ( https://terraform.io ) for other distributions):
14
14
15
15
```
16
16
./terraform-install.sh
17
17
```
18
18
19
- ## Set up the environment
19
+ ## Change to the example directory
20
20
21
21
```
22
22
cd example-custom-machine-types/
23
23
```
24
24
25
- Set the project, replace ` YOUR_PROJECT ` with your project ID:
25
+ ## Set up the environment
26
+
27
+ 1 . Set the project, replace ` YOUR_PROJECT ` with your project ID:
26
28
27
29
```
28
30
PROJECT=YOUR_PROJECT
@@ -32,14 +34,16 @@ PROJECT=YOUR_PROJECT
32
34
gcloud config set project ${PROJECT}
33
35
```
34
36
37
+ 2 . Configure the environment for Terraform:
38
+
35
39
```
36
40
[[ $CLOUD_SHELL ]] || gcloud auth application-default login
37
41
export GOOGLE_PROJECT=$(gcloud config get-value project)
38
42
```
39
43
40
44
## Configure remote backend
41
45
42
- Configure Terraform [ remote backend] ( https://www.terraform.io/docs/backends/types/gcs.html ) for the state file.
46
+ 1 . Configure Terraform [ remote backend] ( https://www.terraform.io/docs/backends/types/gcs.html ) for the state file.
43
47
44
48
```
45
49
BUCKET=${GOOGLE_PROJECT}-terraform
@@ -68,35 +72,35 @@ terraform apply
68
72
69
73
## Testing
70
74
71
- SSH into the bastion host with port forwarding to Cerebro and Kibana:
75
+ 1 . SSH into the bastion host with port forwarding to Cerebro and Kibana:
72
76
73
77
```
74
78
eval $(ssh-agent)
75
79
ssh-add ~/.ssh/google_compute_engine
76
80
eval $(terraform output bastion)
77
81
```
78
82
79
- SSH into the custom machine:
83
+ 2 . SSH into the custom machine:
80
84
81
85
```
82
86
ssh tf-custom-1
83
87
```
84
88
85
- Verify external IP is the IP of the NAT gateway:
89
+ 3 . Verify external IP is the IP of the NAT gateway:
86
90
87
91
```
88
92
curl http://ipinfo.io/ip
89
93
```
90
94
91
95
## Cleanup
92
96
93
- Exit the ssh sessions:
97
+ 1 . Exit the ssh sessions:
94
98
95
99
```
96
100
exit
97
101
```
98
102
99
- Remove all resources created by terraform:
103
+ 2 . Remove all resources created by terraform:
100
104
101
105
```
102
106
terraform destroy
0 commit comments