Skip to content

Commit

Permalink
Deprecate assigned_nat_ip in compute_instance family (#2155)
Browse files Browse the repository at this point in the history
Part of #2143
  • Loading branch information
rileykarson authored Oct 2, 2018
1 parent b5c36b0 commit a4a453d
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/endpoints-on-compute-engine/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ resource "google_compute_instance" "project_1_vm" {
}

output "ip" {
value = "${google_compute_instance.project_1_vm.network_interface.0.access_config.0.assigned_nat_ip}"
value = "${google_compute_instance.project_1_vm.network_interface.0.access_config.0.nat_ip}"
}
4 changes: 2 additions & 2 deletions examples/shared-vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ resource "google_compute_instance" "project_2_vm" {
}

metadata_startup_script = <<EOF
VM1_EXT_IP=${google_compute_instance.project_1_vm.network_interface.0.access_config.0.assigned_nat_ip}
ST_VM_EXT_IP=${google_compute_instance.standalone_project_vm.network_interface.0.access_config.0.assigned_nat_ip}
VM1_EXT_IP=${google_compute_instance.project_1_vm.network_interface.0.access_config.0.nat_ip}
ST_VM_EXT_IP=${google_compute_instance.standalone_project_vm.network_interface.0.access_config.0.nat_ip}
VM1_INT_IP=${google_compute_instance.project_1_vm.network_interface.0.address}
ST_VM_INT_IP=${google_compute_instance.standalone_project_vm.network_interface.0.address}
${file("scripts/install-network-page.sh")}
Expand Down
2 changes: 1 addition & 1 deletion examples/shared-vpc/output.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "status_page_public_ip" {
value = "${google_compute_instance.project_2_vm.network_interface.0.access_config.0.assigned_nat_ip}"
value = "${google_compute_instance.project_2_vm.network_interface.0.access_config.0.nat_ip}"
}
2 changes: 1 addition & 1 deletion examples/two-tier/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ output "pool_public_ip" {
}

output "instance_ips" {
value = "${join(" ", google_compute_instance.www.*.network_interface.0.access_config.0.assigned_nat_ip)}"
value = "${join(" ", google_compute_instance.www.*.network_interface.0.access_config.0.nat_ip)}"
}
5 changes: 3 additions & 2 deletions google/resource_compute_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ func resourceComputeInstance() *schema.Resource {
// nat_ip can be both optional and computed.
// Consider deprecating it.
"assigned_nat_ip": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Deprecated: "Use network_interface.access_config.nat_ip instead.",
},

"public_ptr_domain_name": &schema.Schema{
Expand Down
5 changes: 3 additions & 2 deletions google/resource_compute_instance_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@ func resourceComputeInstanceTemplate() *schema.Resource {
// the schema to allow us to share flatten
// code with an instance, which could.
"assigned_nat_ip": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Deprecated: "Use network_interface.access_config.nat_ip instead.",
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion google/resource_compute_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ func testAccCheckComputeInstanceHasAssignedNatIP(s *terraform.State) error {
if rs.Type != "google_compute_instance" {
continue
}
ip := rs.Primary.Attributes["network_interface.0.access_config.0.assigned_nat_ip"]
ip := rs.Primary.Attributes["network_interface.0.access_config.0.nat_ip"]
if ip == "" {
return fmt.Errorf("No assigned NatIP for instance %s", rs.Primary.Attributes["name"])
}
Expand Down
4 changes: 3 additions & 1 deletion website/docs/d/datasource_compute_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ This attribute has been deprecated. Use `network_interface.0.network_ip` instead

* `network_interface.0.network_ip` - The internal ip address of the instance, either manually or dynamically assigned.

* `network_interface.0.access_config.0.nat_ip` - If the instance has an access config, either the given external ip (in the `nat_ip` field) or the ephemeral (generated) ip (if you didn't provide one).

* `network_interface.0.access_config.0.assigned_nat_ip` - If the instance has an access config, either the given external ip (in the `nat_ip` field) or the ephemeral (generated) ip (if you didn't provide one).
* `network_interface.0.access_config.0.assigned_nat_ip` - (Deprecated) If the instance has an access config, either the given external ip (in the `nat_ip` field) or the ephemeral (generated) ip (if you didn't provide one).
This attribute has been deprecated. Use `network_interface.0.access_config.0.nat_ip` instead.

* `attached_disk.0.disk_encryption_key_sha256` - The [RFC 4648 base64](https://tools.ietf.org/html/rfc4648#section-4)
encoded SHA-256 hash of the [customer-supplied encryption key]
Expand Down
5 changes: 4 additions & 1 deletion website/docs/r/compute_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ This attribute has been deprecated. Use `network_interface.0.network_ip`instead.

* `network_interface.0.network_ip` - The internal ip address of the instance, either manually or dynamically assigned.

* `network_interface.0.access_config.0.assigned_nat_ip` - If the instance has an access config, either the given external ip (in the `nat_ip` field) or the ephemeral (generated) ip (if you didn't provide one).
* `network_interface.0.access_config.0.nat_ip` - If the instance has an access config, either the given external ip (in the `nat_ip` field) or the ephemeral (generated) ip (if you didn't provide one).

* `network_interface.0.access_config.0.assigned_nat_ip` - (Deprecated) If the instance has an access config, either the given external ip (in the `nat_ip` field) or the ephemeral (generated) ip (if you didn't provide one).
This attribute has been deprecated. Use `network_interface.0.access_config.0.nat_ip` instead.

* `attached_disk.0.disk_encryption_key_sha256` - The [RFC 4648 base64](https://tools.ietf.org/html/rfc4648#section-4)
encoded SHA-256 hash of the [customer-supplied encryption key]
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/dns_record_set.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ resource "google_dns_record_set" "frontend" {
managed_zone = "${google_dns_managed_zone.prod.name}"
rrdatas = ["${google_compute_instance.frontend.network_interface.0.access_config.0.assigned_nat_ip}"]
rrdatas = ["${google_compute_instance.frontend.network_interface.0.access_config.0.nat_ip}"]
}
resource "google_compute_instance" "frontend" {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/sql_database_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ data "null_data_source" "auth_netw_postgres_allowed_1" {
inputs = {
name = "apps-${count.index + 1}"
value = "${element(google_compute_instance.apps.*.network_interface.0.access_config.0.assigned_nat_ip, count.index)}"
value = "${element(google_compute_instance.apps.*.network_interface.0.access_config.0.nat_ip, count.index)}"
}
}
Expand Down

0 comments on commit a4a453d

Please sign in to comment.