ILB example instances no longer have external IPs
This commit is contained in:
parent
f0dec4c564
commit
0bd27f068d
|
@ -65,15 +65,11 @@ resource "google_compute_instance" "ilb-instance-1" {
|
|||
}
|
||||
}
|
||||
|
||||
metadata_startup_script = <<EOF
|
||||
#! /bin/bash
|
||||
apt-get update
|
||||
apt-get install apache2 -y
|
||||
a2ensite default-ssl
|
||||
a2enmod ssl
|
||||
service apache2 restart
|
||||
echo '<!doctype html><html><body><h1>ilb-instance-1</h1></body></html>' | tee /var/www/html/index.html
|
||||
EOF
|
||||
service_account {
|
||||
scopes = ["compute-rw"]
|
||||
}
|
||||
|
||||
metadata_startup_script = "${file("startup.sh")}"
|
||||
}
|
||||
|
||||
resource "google_compute_instance" "ilb-instance-2" {
|
||||
|
@ -94,15 +90,11 @@ resource "google_compute_instance" "ilb-instance-2" {
|
|||
}
|
||||
}
|
||||
|
||||
metadata_startup_script = <<EOF
|
||||
#! /bin/bash
|
||||
apt-get update
|
||||
apt-get install apache2 -y
|
||||
a2ensite default-ssl
|
||||
a2enmod ssl
|
||||
service apache2 restart
|
||||
echo '<!doctype html><html><body><h1>ilb-instance-2</h1></body></html>' | tee /var/www/html/index.html
|
||||
EOF
|
||||
service_account {
|
||||
scopes = ["compute-rw"]
|
||||
}
|
||||
|
||||
metadata_startup_script = "${file("startup.sh")}"
|
||||
}
|
||||
|
||||
resource "google_compute_instance" "ilb-instance-3" {
|
||||
|
@ -123,15 +115,11 @@ resource "google_compute_instance" "ilb-instance-3" {
|
|||
}
|
||||
}
|
||||
|
||||
metadata_startup_script = <<EOF
|
||||
#! /bin/bash
|
||||
apt-get update
|
||||
apt-get install apache2 -y
|
||||
a2ensite default-ssl
|
||||
a2enmod ssl
|
||||
service apache2 restart
|
||||
echo '<!doctype html><html><body><h1>ilb-instance-3</h1></body></html>' | tee /var/www/html/index.html
|
||||
EOF
|
||||
service_account {
|
||||
scopes = ["compute-rw"]
|
||||
}
|
||||
|
||||
metadata_startup_script = "${file("startup.sh")}"
|
||||
}
|
||||
|
||||
resource "google_compute_instance" "ilb-instance-4" {
|
||||
|
@ -152,15 +140,11 @@ resource "google_compute_instance" "ilb-instance-4" {
|
|||
}
|
||||
}
|
||||
|
||||
metadata_startup_script = <<EOF
|
||||
#! /bin/bash
|
||||
apt-get update
|
||||
apt-get install apache2 -y
|
||||
a2ensite default-ssl
|
||||
a2enmod ssl
|
||||
service apache2 restart
|
||||
echo '<!doctype html><html><body><h1>ilb-instance-4</h1></body></html>' | tee /var/www/html/index.html
|
||||
EOF
|
||||
service_account {
|
||||
scopes = ["compute-rw"]
|
||||
}
|
||||
|
||||
metadata_startup_script = "${file("startup.sh")}"
|
||||
}
|
||||
|
||||
resource "google_compute_instance_group" "us-ig1" {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#! /bin/bash
|
||||
apt-get update
|
||||
apt-get install apache2 -y
|
||||
a2ensite default-ssl
|
||||
a2enmod ssl
|
||||
service apache2 restart
|
||||
INSTANCE_NAME=`curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/hostname | awk -F "." '{print $1}'`
|
||||
ZONE=`curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/zone | awk -F "/" '{print $NF}'`
|
||||
echo '<!doctype html><html><body><h1>'$INSTANCE_NAME'</h1></body></html>' | tee /var/www/html/index.html
|
||||
gcloud compute instances delete-access-config $INSTANCE_NAME --zone $ZONE
|
Loading…
Reference in New Issue