fix iot updatemask and docs (#1640)

This commit is contained in:
Dana Hoffman 2018-06-13 12:37:21 -07:00 committed by GitHub
parent 0497eec580
commit d424cf05ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -243,7 +243,7 @@ func resourceCloudIoTRegistryUpdate(d *schema.ResourceData, meta interface{}) er
if d.HasChange("event_notification_config") {
hasChanged = true
updateMask = append(updateMask, "event_notification_config")
updateMask = append(updateMask, "event_notification_configs")
if v, ok := d.GetOk("event_notification_config"); ok {
deviceRegistry.EventNotificationConfigs = make([]*cloudiot.EventNotificationConfig, 1, 1)
deviceRegistry.EventNotificationConfigs[0] = buildEventNotificationConfig(v.(map[string]interface{}))
@ -251,21 +251,21 @@ func resourceCloudIoTRegistryUpdate(d *schema.ResourceData, meta interface{}) er
}
if d.HasChange("state_notification_config") {
hasChanged = true
updateMask = append(updateMask, "state_notification_config")
updateMask = append(updateMask, "state_notification_config.pubsub_topic_name")
if v, ok := d.GetOk("state_notification_config"); ok {
deviceRegistry.StateNotificationConfig = buildStateNotificationConfig(v.(map[string]interface{}))
}
}
if d.HasChange("mqtt_config") {
hasChanged = true
updateMask = append(updateMask, "mqtt_config")
updateMask = append(updateMask, "mqtt_config.mqtt_enabled_state")
if v, ok := d.GetOk("mqtt_config"); ok {
deviceRegistry.MqttConfig = buildMqttConfig(v.(map[string]interface{}))
}
}
if d.HasChange("http_config") {
hasChanged = true
updateMask = append(updateMask, "http_config")
updateMask = append(updateMask, "http_config.http_enabled_state")
if v, ok := d.GetOk("http_config"); ok {
deviceRegistry.HttpConfig = buildHttpConfig(v.(map[string]interface{}))
}

View File

@ -135,7 +135,7 @@ resource "google_pubsub_topic" "default-telemetry" {
resource "google_cloudiot_registry" "foobar" {
depends_on = ["google_project_iam_binding.cloud-iot-iam-binding"]
name = "psregistry-test-%s"
name = "%s"
event_notification_config = {
pubsub_topic_name = "${google_pubsub_topic.default-devicestatus.id}"

View File

@ -6,11 +6,11 @@ description: |-
Creates a device registry in Google's Cloud IoT Core platform
---
# google\cloudiot\_registry
# google\_cloudiot\_registry
Creates a device registry in Google's Cloud IoT Core platform. For more information see
[the official documentation](https://cloud.google.com/iot/docs/) and
[API](https://cloud.google.com/iot/docs/reference/rest/v1/projects.locations.registries).
[API](https://cloud.google.com/iot/docs/reference/cloudiot/rest/v1/projects.locations.registries).
## Example Usage