Merge pull request #5245 from lwander/f-gcp-sql-address
provider/google: Add support for reading SQL instance assigned IP Addresses
This commit is contained in:
commit
252db7bacd
|
@ -170,6 +170,23 @@ func resourceSqlDatabaseInstance() *schema.Resource {
|
|||
},
|
||||
},
|
||||
},
|
||||
"ip_address": &schema.Schema{
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"ip_address": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"time_to_retire": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"replica_configuration": &schema.Schema{
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
|
@ -700,6 +717,19 @@ func resourceSqlDatabaseInstanceRead(d *schema.ResourceData, meta interface{}) e
|
|||
}
|
||||
}
|
||||
|
||||
_ipAddresses := make([]interface{}, len(instance.IpAddresses))
|
||||
|
||||
for i, ip := range instance.IpAddresses {
|
||||
_ipAddress := make(map[string]interface{})
|
||||
|
||||
_ipAddress["ip_address"] = ip.IpAddress
|
||||
_ipAddress["time_to_retire"] = ip.TimeToRetire
|
||||
|
||||
_ipAddresses[i] = _ipAddress
|
||||
}
|
||||
|
||||
d.Set("ip_address", _ipAddresses)
|
||||
|
||||
if v, ok := d.GetOk("master_instance_name"); ok && v != nil {
|
||||
d.Set("master_instance_name", instance.MasterInstanceName)
|
||||
}
|
||||
|
|
|
@ -148,3 +148,11 @@ The following attributes are exported:
|
|||
The `settings` block exports:
|
||||
|
||||
* `version` - Used to make sure changes to the `settings` block are atomic.
|
||||
|
||||
The `ip_address` block exports a list of IPv4 addresses assigned to this
|
||||
instance, with the following properties:
|
||||
|
||||
* `ip_address` - The IPv4 address assigned.
|
||||
|
||||
* `time_to_retire` - The time this IP address will be retired, in RFC 3339
|
||||
format.
|
||||
|
|
Loading…
Reference in New Issue