mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-27 00:46:25 -06:00
Merge pull request #4265 from lwander/gcp-assigned-nat-ip
provider/google: provide assigned_nat_ip as well as nat_ip
This commit is contained in:
commit
504bc87ec6
@ -137,9 +137,13 @@ func resourceComputeInstance() *schema.Resource {
|
|||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"nat_ip": &schema.Schema{
|
"nat_ip": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"assigned_nat_ip": &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -637,9 +641,10 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
|
|||||||
var natIP string
|
var natIP string
|
||||||
accessConfigs := make(
|
accessConfigs := make(
|
||||||
[]map[string]interface{}, 0, len(iface.AccessConfigs))
|
[]map[string]interface{}, 0, len(iface.AccessConfigs))
|
||||||
for _, config := range iface.AccessConfigs {
|
for j, config := range iface.AccessConfigs {
|
||||||
accessConfigs = append(accessConfigs, map[string]interface{}{
|
accessConfigs = append(accessConfigs, map[string]interface{}{
|
||||||
"nat_ip": config.NatIP,
|
"nat_ip": d.Get(fmt.Sprintf("network_interface.%d.access_config.%d.nat_ip", i, j)),
|
||||||
|
"assigned_nat_ip": config.NatIP,
|
||||||
})
|
})
|
||||||
|
|
||||||
if natIP == "" {
|
if natIP == "" {
|
||||||
|
@ -133,6 +133,10 @@ The `access_config` block supports:
|
|||||||
* `nat_ip` - (Optional) The IP address that will be 1:1 mapped to the instance's network ip. If not
|
* `nat_ip` - (Optional) The IP address that will be 1:1 mapped to the instance's network ip. If not
|
||||||
given, one will be generated.
|
given, one will be generated.
|
||||||
|
|
||||||
|
* `assigned_nat_ip` - (Optional) The IP address that is assigned to the
|
||||||
|
instance. If `nat_ip` is filled, it will appear here. If `nat_ip` is left
|
||||||
|
blank, the ephemeral assigned IP will appear here.
|
||||||
|
|
||||||
(DEPRECATED) The `network` block supports:
|
(DEPRECATED) The `network` block supports:
|
||||||
|
|
||||||
* `source` - (Required) The name of the network to attach this interface to.
|
* `source` - (Required) The name of the network to attach this interface to.
|
||||||
|
@ -40,7 +40,7 @@ resource "google_dns_record_set" "frontend" {
|
|||||||
name = "frontend.${google_dns_managed_zone.prod.dns_name}"
|
name = "frontend.${google_dns_managed_zone.prod.dns_name}"
|
||||||
type = "A"
|
type = "A"
|
||||||
ttl = 300
|
ttl = 300
|
||||||
rrdatas = ["${google_compute_instance.frontend.network_interface.0.access_config.0.nat_ip}"]
|
rrdatas = ["${google_compute_instance.frontend.network_interface.0.access_config.0.assigned_nat_ip}"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user