Skip to content

Commit

Permalink
Add a computed field for uptime check id (#3138)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and chrisst committed Mar 1, 2019
1 parent 1a5624c commit bc91f6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions google/resource_monitoring_uptime_check_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ func resourceMonitoringUptimeCheckConfig() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"uptime_check_id": {
Type: schema.TypeString,
Computed: true,
},
"project": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -354,6 +358,9 @@ func resourceMonitoringUptimeCheckConfigRead(d *schema.ResourceData, meta interf
if err := d.Set("name", flattenMonitoringUptimeCheckConfigName(res["name"], d)); err != nil {
return fmt.Errorf("Error reading UptimeCheckConfig: %s", err)
}
if err := d.Set("uptime_check_id", flattenMonitoringUptimeCheckConfigUptimeCheckId(res["id"], d)); err != nil {
return fmt.Errorf("Error reading UptimeCheckConfig: %s", err)
}
if err := d.Set("display_name", flattenMonitoringUptimeCheckConfigDisplayName(res["displayName"], d)); err != nil {
return fmt.Errorf("Error reading UptimeCheckConfig: %s", err)
}
Expand Down Expand Up @@ -553,6 +560,11 @@ func flattenMonitoringUptimeCheckConfigName(v interface{}, d *schema.ResourceDat
return v
}

func flattenMonitoringUptimeCheckConfigUptimeCheckId(v interface{}, d *schema.ResourceData) interface{} {
parts := strings.Split(d.Get("name").(string), "/")
return parts[len(parts)-1]
}

func flattenMonitoringUptimeCheckConfigDisplayName(v interface{}, d *schema.ResourceData) interface{} {
return v
}
Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/monitoring_uptime_check_config.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ In addition to the arguments listed above, the following computed attributes are
* `name` -
A unique resource name for this UptimeCheckConfig. The format is projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].

* `uptime_check_id` -
The id of the uptime check


## Timeouts

Expand Down

0 comments on commit bc91f6b

Please sign in to comment.