|
| 1 | +--- |
| 2 | +layout: "google" |
| 3 | +page_title: "Google: google_cloudiot_registry" |
| 4 | +sidebar_current: "docs-google-cloudiot-registry-x" |
| 5 | +description: |- |
| 6 | + Creates a device registry in Google's Cloud IoT Core platform |
| 7 | +--- |
| 8 | + |
| 9 | +# google\cloudiot\_registry |
| 10 | + |
| 11 | + Creates a device registry in Google's Cloud IoT Core platform. For more information see |
| 12 | +[the official documentation](https://cloud.google.com/iot/docs/) and |
| 13 | +[API](https://cloud.google.com/iot/docs/reference/rest/v1/projects.locations.registries). |
| 14 | + |
| 15 | + |
| 16 | +## Example Usage |
| 17 | + |
| 18 | +```hcl |
| 19 | +resource "google_pubsub_topic" "default-devicestatus" { |
| 20 | + name = "default-devicestatus" |
| 21 | +} |
| 22 | +
|
| 23 | +resource "google_pubsub_topic" "default-telemetry" { |
| 24 | + name = "default-telemetry" |
| 25 | +} |
| 26 | +
|
| 27 | +resource "google_cloudiot_registry" "default-registry" { |
| 28 | + name = "default-registry" |
| 29 | +
|
| 30 | + event_notification_config = { |
| 31 | + pubsub_topic_name = "${google_pubsub_topic.default-devicestatus.id}" |
| 32 | + } |
| 33 | +
|
| 34 | + state_notification_config = { |
| 35 | + pubsub_topic_name = "${google_pubsub_topic.default-telemetry.id}" |
| 36 | + } |
| 37 | +
|
| 38 | + http_config = { |
| 39 | + http_enabled_state = "HTTP_ENABLED" |
| 40 | + } |
| 41 | +
|
| 42 | + mqtt_config = { |
| 43 | + mqtt_enabled_state = "MQTT_ENABLED" |
| 44 | + } |
| 45 | +
|
| 46 | + credentials = [ |
| 47 | + { |
| 48 | + public_key_certificate = { |
| 49 | + format = "X509_CERTIFICATE_PEM" |
| 50 | + certificate = "${file("rsa_cert.pem")}" |
| 51 | + } |
| 52 | + }, |
| 53 | + ] |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | +## Argument Reference |
| 58 | + |
| 59 | +The following arguments are supported: |
| 60 | + |
| 61 | +* `name` - (Required) A unique name for the resource, required by device registry. |
| 62 | + Changing this forces a new resource to be created. |
| 63 | + |
| 64 | +- - - |
| 65 | + |
| 66 | +* `project` - (Optional) The project in which the resource belongs. If it is not provided, the provider project is used. |
| 67 | + |
| 68 | +* `region` - (Optional) The Region in which the created address should reside. If it is not provided, the provider region is used. |
| 69 | + |
| 70 | +* `event_notification_config` - (Optional) A PubSub topics to publish device events. Structure is documented below. |
| 71 | + |
| 72 | +* `state_notification_config` - (Optional) A PubSub topic to publish device state updates. Structure is documented below. |
| 73 | + |
| 74 | +* `mqtt_config` - (Optional) Activate or deactivate MQTT. Structure is documented below. |
| 75 | +* `http_config` - (Optional) Activate or deactivate HTTP. Structure is documented below. |
| 76 | + |
| 77 | +* `credentials` - (Optional) List of public key certificates to authenticate devices. Structure is documented below. |
| 78 | + |
| 79 | + |
| 80 | +The `event_notification_config` block supports: |
| 81 | + |
| 82 | +* `pubsub_topic_name` - (Required) PubSub topic name to publish device events. |
| 83 | + |
| 84 | +The `state_notification_config` block supports: |
| 85 | + |
| 86 | +* `pubsub_topic_name` - (Required) PubSub topic name to publish device state updates. |
| 87 | + |
| 88 | +The `mqtt_config` block supports: |
| 89 | + |
| 90 | +* `mqtt_enabled_state` - (Required) The field allows `MQTT_ENABLED` or `MQTT_DISABLED`. |
| 91 | + |
| 92 | +The `http_config` block supports: |
| 93 | + |
| 94 | +* `http_enabled_state` - (Required) The field allows `HTTP_ENABLED` or `HTTP_DISABLED`. |
| 95 | + |
| 96 | +The `credentials` block supports: |
| 97 | + |
| 98 | +* `public_key_certificate` - (Required) The certificate format and data. |
| 99 | + |
| 100 | +The `public_key_certificate` block supports: |
| 101 | + |
| 102 | +* `format` - (Required) The field allows only `X509_CERTIFICATE_PEM`. |
| 103 | +* `certificate` - (Required) The certificate data. |
| 104 | + |
| 105 | + |
| 106 | +## Attributes Reference |
| 107 | + |
| 108 | +Only the arguments listed above are exposed as attributes. |
| 109 | + |
| 110 | +## Import |
| 111 | + |
| 112 | +A device registry can be imported using the `name`, e.g. |
| 113 | + |
| 114 | +``` |
| 115 | +$ terraform import google_cloudiot_registry.default-registry projects/{project}/locations/{region}/registries/{name} |
| 116 | +``` |
0 commit comments