Skip to content

Commit 0b8e48d

Browse files
committed
Re-add ipv4 output needed for tests run remotely
- Remove image name and port variables to simplify example. - Update docs
1 parent 80bf88d commit 0b8e48d

File tree

5 files changed

+7
-22
lines changed

5 files changed

+7
-22
lines changed

examples/instance_with_config_file/README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ This example illustrates how to deploy and expose a container to a Google Comput
1010
| additional\_metadata | Additional metadata to attach to the instance | map(string) | `<map>` | no |
1111
| client\_email | Service account email address | string | `""` | no |
1212
| cos\_image\_name | The forced COS image to use instead of latest | string | `"cos-stable-77-12371-89-0"` | no |
13-
| image | The Docker image to deploy to GCE instances | string | `"gcr.io/google-samples/hello-app:1.0"` | no |
14-
| image\_port | The port the image exposes for HTTP requests | string | `"8080"` | no |
1513
| instance\_name | The desired name to assign to the deployed instance | string | `"hello-world-container-vm"` | no |
16-
| machine\_type | The GCP machine type to deploy | string | `"n1-standard-1"` | no |
1714
| project\_id | The project ID to deploy resources into | string | n/a | yes |
18-
| restart\_policy | The desired Docker restart policy for the deployed image | string | `"Always"` | no |
1915
| subnetwork | The name of the subnetwork to deploy instances into | string | n/a | yes |
2016
| subnetwork\_project | The project ID where the desired subnetwork is provisioned | string | n/a | yes |
2117
| zone | The GCP zone to deploy instances into | string | n/a | yes |
@@ -25,9 +21,6 @@ This example illustrates how to deploy and expose a container to a Google Comput
2521
| Name | Description |
2622
|------|-------------|
2723
| container | The container metadata provided to the module |
28-
| cos\_image\_name | The cos image used |
29-
| http\_address | The IP address on which the HTTP service is exposed |
30-
| http\_port | The port on which the HTTP service is exposed |
3124
| instance\_name | The deployed instance name |
3225
| ipv4 | The public IP address of the deployed instance |
3326
| vm\_container\_label | The instance label containing container configuration |

examples/instance_with_config_file/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module "gce-container" {
3434
cos_image_name = var.cos_image_name
3535

3636
container = {
37-
image = var.image
37+
image = "gcr.io/google-samples/hello-app:1.0"
3838

3939
volumeMounts = [
4040
{

examples/instance_with_config_file/outputs.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
output "instance_name" {
1818
description = "The deployed instance name"
19-
value = google_compute_instance.vm.instance_name
19+
value = google_compute_instance.vm.name
2020
}
2121

2222
output "vm_container_label" {
@@ -33,3 +33,8 @@ output "volumes" {
3333
description = "The volume metadata provided to the module"
3434
value = module.gce-container.volumes
3535
}
36+
37+
output "ipv4" {
38+
description = "The public IP address of the deployed instance"
39+
value = google_compute_instance.vm.network_interface.0.access_config.0.nat_ip
40+
}

examples/instance_with_config_file/variables.tf

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@ variable "instance_name" {
3131
default = "hello-world-container-vm"
3232
}
3333

34-
variable "image" {
35-
description = "The Docker image to deploy to GCE instances"
36-
default = "gcr.io/google-samples/hello-app:1.0"
37-
}
38-
39-
variable "image_port" {
40-
description = "The port the image exposes for HTTP requests"
41-
default = "8080"
42-
}
43-
4434
variable "zone" {
4535
description = "The GCP zone to deploy instances into"
4636
type = string

test/fixtures/instance_with_config_file/example.tf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ module "example" {
3838
instance_name = "cft-test-${local.example_name}-${random_string.suffix.result}"
3939
client_email = var.sa_email
4040

41-
image = "gcr.io/google-samples/hello-app:1.0"
42-
image_port = "8080"
43-
4441
additional_metadata = {
4542
"sshKeys" = "user:${tls_private_key.gce-keypair.public_key_openssh}"
4643
}

0 commit comments

Comments
 (0)