» google_cloudiot_registry

A Google Cloud IoT Core device registry.

To get more information about DeviceRegistry, see:

» Example Usage - Cloudiot Device Registry Basic

resource "google_cloudiot_registry" "test-registry" {
  name     = "cloudiot-registry"
}

» Example Usage - Cloudiot Device Registry Single Event Notification Configs

resource "google_pubsub_topic" "default-telemetry" {
  name = "default-telemetry"
}

resource "google_cloudiot_registry" "test-registry" {
  name     = "cloudiot-registry"

  event_notification_configs {
    pubsub_topic_name = google_pubsub_topic.default-telemetry.id
    subfolder_matches = ""
  }

}

» Example Usage - Cloudiot Device Registry Full

resource "google_pubsub_topic" "default-devicestatus" {
  name = "default-devicestatus"
}

resource "google_pubsub_topic" "default-telemetry" {
  name = "default-telemetry"
}

resource "google_pubsub_topic" "additional-telemetry" {
  name = "additional-telemetry"
}

resource "google_cloudiot_registry" "test-registry" {
  name     = "cloudiot-registry"

  event_notification_configs {
    pubsub_topic_name = google_pubsub_topic.additional-telemetry.id
    subfolder_matches = "test/path"
  }

  event_notification_configs {
    pubsub_topic_name = google_pubsub_topic.default-telemetry.id
    subfolder_matches = ""
  }

  state_notification_config = {
    pubsub_topic_name = google_pubsub_topic.default-devicestatus.id
  }

  mqtt_config = {
    mqtt_enabled_state = "MQTT_ENABLED"
  }

  http_config = {
    http_enabled_state = "HTTP_ENABLED"
  }

  log_level = "INFO"

  credentials {
    public_key_certificate = {
      format      = "X509_CERTIFICATE_PEM"
      certificate = file("test-fixtures/rsa_cert.pem")
    }
  }
}

» Argument Reference

The following arguments are supported:

  • name - (Required) A unique name for the resource, required by device registry.

  • event_notification_configs - (Optional) List of configurations for event notifications, such as PubSub topics to publish device events to. Structure is documented below.

  • log_level - (Optional) The default logging verbosity for activity from devices in this registry. Specifies which events should be written to logs. For example, if the LogLevel is ERROR, only events that terminate in errors will be logged. LogLevel is inclusive; enabling INFO logging will also enable ERROR logging. Default value is NONE. Possible values are NONE, ERROR, INFO, and DEBUG.

  • region - (Optional) The region in which the created registry should reside. If it is not provided, the provider region is used.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

  • state_notification_config - A PubSub topic to publish device state updates. The structure is documented below.

  • mqtt_config - Activate or deactivate MQTT. The structure is documented below.

  • http_config - Activate or deactivate HTTP. The structure is documented below.

  • credentials - List of public key certificates to authenticate devices. The structure is documented below.

The state_notification_config block supports:

The mqtt_config block supports:

The http_config block supports:

The credentials block supports:

The public_key_certificate block supports:

  • format - The field allows only X509_CERTIFICATE_PEM.

  • certificate - The certificate data.

The event_notification_configs block supports:

  • subfolder_matches - (Optional) If the subfolder name matches this string exactly, this configuration will be used. The string must not include the leading '/' character. If empty, all strings are matched. Empty value can only be used for the last event_notification_configs item.

  • pubsub_topic_name - (Required) PubSub topic name to publish device events.

» Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/locations/{{region}}/registries/{{name}}

» Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 4 minutes.
  • update - Default is 4 minutes.
  • delete - Default is 4 minutes.

» Import

DeviceRegistry can be imported using any of these accepted formats:

$ terraform import google_cloudiot_registry.default {{project}}/locations/{{region}}/registries/{{name}}
$ terraform import google_cloudiot_registry.default {{project}}/{{region}}/{{name}}
$ terraform import google_cloudiot_registry.default {{region}}/{{name}}
$ terraform import google_cloudiot_registry.default {{name}}

» User Project Overrides

This resource supports User Project Overrides.