-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Thulasiraj Komminar edited this page Aug 16, 2024
·
4 revisions
terraform {
required_providers {
influxdb = {
source = "komminarlabs/influxdb"
version = "1.0.0"
}
}
}
provider "influxdb" {
token = "influxdb-token"
url = "http://localhost:8086"
}
resource "influxdb_organization" "iot" {
name = "IoT"
description = "An IoT organization"
}
resource "influxdb_bucket" "signals" {
org_id = influxdb_organization.iot.id
name = "signals"
description = "This is a bucket to store signals"
retention_period = 1209600
}
resource "influxdb_authorization" "signals_rw" {
org_id = influxdb_organization.iot.id
description = "Read & Write access signals bucket"
permissions = [{
action = "read"
resource = {
id = influxdb_bucket.signals.id
org_id = influxdb_organization.iot.id
type = "buckets"
}
},
{
action = "write"
resource = {
id = influxdb_bucket.signals.id
org_id = influxdb_organization.iot.id
type = "buckets"
}
}]
}
data "influxdb_organization" "iot" {
name = "IoT"
}
output "iot_organization" {
value = data.influxdb_organization.iot
}
data "influxdb_bucket" "signals" {
name = "signals"
}
output "signals_bucket" {
value = data.influxdb_bucket.signals
}