Skip to content

googleCloudiotRegistry

A Google Cloud IoT Core device registry.

To get more information about DeviceRegistry, see:

Example Usage - Cloudiot Device Registry Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.cloudiotRegistry.CloudiotRegistry(this, "test-registry", {
  name: "cloudiot-registry",
});

Example Usage - Cloudiot Device Registry Single Event Notification Configs

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googlePubsubTopicDefaultTelemetry = new google.pubsubTopic.PubsubTopic(
  this,
  "default-telemetry",
  {
    name: "default-telemetry",
  }
);
new google.cloudiotRegistry.CloudiotRegistry(this, "test-registry", {
  event_notification_configs: [
    {
      pubsub_topic_name: googlePubsubTopicDefaultTelemetry.id,
      subfolder_matches: "",
    },
  ],
  name: "cloudiot-registry",
});

Example Usage - Cloudiot Device Registry Full

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googlePubsubTopicAdditionalTelemetry = new google.pubsubTopic.PubsubTopic(
  this,
  "additional-telemetry",
  {
    name: "additional-telemetry",
  }
);
const googlePubsubTopicDefaultDevicestatus = new google.pubsubTopic.PubsubTopic(
  this,
  "default-devicestatus",
  {
    name: "default-devicestatus",
  }
);
const googlePubsubTopicDefaultTelemetry = new google.pubsubTopic.PubsubTopic(
  this,
  "default-telemetry",
  {
    name: "default-telemetry",
  }
);
new google.cloudiotRegistry.CloudiotRegistry(this, "test-registry", {
  credentials: [
    {
      public_key_certificate: [
        {
          certificate: '${file("test-fixtures/rsa_cert.pem")}',
          format: "X509_CERTIFICATE_PEM",
        },
      ],
    },
  ],
  event_notification_configs: [
    {
      pubsub_topic_name: googlePubsubTopicAdditionalTelemetry.id,
      subfolder_matches: "test/path",
    },
    {
      pubsub_topic_name: googlePubsubTopicDefaultTelemetry.id,
      subfolder_matches: "",
    },
  ],
  http_config: [
    {
      http_enabled_state: "HTTP_ENABLED",
    },
  ],
  log_level: "INFO",
  mqtt_config: [
    {
      mqtt_enabled_state: "MQTT_ENABLED",
    },
  ],
  name: "cloudiot-registry",
  state_notification_config: [
    {
      pubsub_topic_name: googlePubsubTopicDefaultDevicestatus.id,
    },
  ],
});

Argument Reference

The following arguments are supported:

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

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

  • logLevel - (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.

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

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

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

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

The stateNotificationConfig block supports:

  • pubsubTopicName - PubSub topic name to publish device state updates.

The mqttConfig block supports:

  • mqttEnabledState - The field allows mqttEnabled or mqttDisabled.

The httpConfig block supports:

  • httpEnabledState - The field allows httpEnabled or httpDisabled.

The credentials block supports:

  • publicKeyCertificate - A public key certificate format and data.

The publicKeyCertificate block supports:

  • format - The field allows only x509CertificatePem.

  • certificate - The certificate data.

The eventNotificationConfigs block supports:

  • subfolderMatches - (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 eventNotificationConfigs item.

  • pubsubTopicName - (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 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 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.