Skip to content

fix iot updatemask and docs #1640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions google/resource_cloudiot_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,29 +243,29 @@ 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{}))
}
}
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{}))
}
Expand Down
2 changes: 1 addition & 1 deletion google/resource_cloudiot_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/cloudiot_registry.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down