Skip to content

Commit

Permalink
Merge pull request #10 from hasanhakkaev/updates
Browse files Browse the repository at this point in the history
updated deps, added bucket data source, fixed typos and some houskeeping
  • Loading branch information
hasanhakkaev authored May 14, 2023
2 parents 7aba0ad + beb5086 commit 568122c
Show file tree
Hide file tree
Showing 23 changed files with 597 additions and 130 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
- name: Install Task
uses: arduino/setup-task@v1

- name: Set up Go 1.18
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.18
go-version: 1.20
id: go

- name: Check out code into the Go module directory
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ website/node_modules
.vagrant/
*.backup
./*.tfstate
examples/**/**/.terraform/
examples/**/**/*provider.tf
examples/**/**/*.tfstate
examples/**/**/.terraform.lock.hcl
examples/**/**/.terraformrc
examples/.terraformrc
.terraform/
*.log
*.bak
Expand All @@ -25,6 +31,7 @@ website/node_modules
*.test
*.iml
*.env
.envrc
website/vendor
.task/
vendor/
Expand All @@ -34,3 +41,4 @@ vendor/

# Keep windows files with windows line endings
*.winfile eol=crlf
!/examples/.terraformrc
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ builds:
# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like Terraform Cloud where
# they are unable to install libraries.
- CGO_ENABLED=0
# - CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
Expand Down
8 changes: 3 additions & 5 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ version: '3'
vars:
BINARY_FOLDER: bin
NAME: influxdb-v2
GOLANGCI_LINT_VERSION: v1.49.0
VERSION: v0.4.4
GOLANGCI_LINT_VERSION: v1.52.2
VERSION: v0.4.5
NAMESPACE: hasanhakkaev

dotenv: ['.env']
Expand Down Expand Up @@ -66,9 +66,7 @@ tasks:
start-influx:
desc: Start InfluxDB
cmds:
- ./scripts/setup-influxdb.sh
status:
- while ! $(curl -sS 'http://localhost:8086/ready' | grep -q ready); do echo 'Waiting for influx...'; sleep 1; done
- ./scripts/setup_influxdb.sh
stop-influx:
desc: Stop InfluxDB
cmds:
Expand Down
62 changes: 62 additions & 0 deletions docs/data-sources/bucket.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "influxdb-v2_bucket Data Source - terraform-provider-influxdb-v2"
subcategory: ""
description: |-
Lookup a Bucket in InfluxDB2.
---

# influxdb-v2_bucket (Data Source)

Lookup a Bucket in InfluxDB2.

## Example Usage

```terraform
data "influxdb-v2_bucket" "bucket" {
name = "newName"
}
output "influxdb-v2_bucket4" {
value = data.influxdb-v2_bucket.bucket
}
terraform {
required_providers {
influxdb-v2 = {
source = "local/local/influxdb-v2"
version = "0.4.5"
}
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Bucket name.

### Read-Only

- `created_at` (String) The string time that the Bucket was created.
- `created_timestamp` (Number) The timestamp that the Bucket was created.
- `description` (String) Description of the bucket.
- `id` (String) Bucket id.
- `org_id` (String) ID of organization in which to create a bucket.
- `retention_rules` (Set of Object) Rules to expire or retain data. No rules means data never expires. (see [below for nested schema](#nestedatt--retention_rules))
- `type` (String) Bucket type.
- `updated_at` (String) The string time that the Bucket was last updated.
- `updated_timestamp` (Number) The timestamp that the Bucket was last updated.

<a id="nestedatt--retention_rules"></a>
### Nested Schema for `retention_rules`

Read-Only:

- `every_seconds` (Number)
- `shard_group_duration_seconds` (Number)
- `type` (String)


65 changes: 49 additions & 16 deletions docs/data-sources/organization.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,69 @@
---
layout: "influxdb-v2"
page_title: "InfluxDB V2: influxdb-v2_organization"
sidebar_current: "docs-influxdb-v2-datasource-organization"
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "influxdb-v2_organization Data Source - terraform-provider-influxdb-v2"
subcategory: ""
description: |-
The influxdb-v2_organization data source returns influxdb status.
Lookup an Organization in InfluxDB2.
---

# influxdb-v2\_organization (Data Source)
# influxdb-v2_organization (Data Source)

The influxdb-v2_organization data source retrieves influxdb organization information.
Lookup an Organization in InfluxDB2.

## Example Usage

```hcl
```terraform
data "influxdb-v2_organization" "organization" {
name = "my-org"
name = "testorg"
}
output "influxdb-v2_organization_id" {
value = data.influxdb-v2_organization.organization.id
value = data.influxdb-v2_organization.organization.id
}
output "influxdb-v2_organization_name" {
value = data.influxdb-v2_organization.organization.name
}
output "influxdb-v2_organization_description" {
value = data.influxdb-v2_organization.organization.description
}
output "influxdb-v2_organization_created_at" {
value = data.influxdb-v2_organization.organization.created_at
}
output "influxdb-v2_organization_updated_at" {
value = data.influxdb-v2_organization.organization.updated_at
}
terraform {
required_providers {
influxdb-v2 = {
source = "local/local/influxdb-v2"
version = "0.4.5"
}
}
}
```

## Argument Reference
<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Name of the Organization.

### Optional

* ``name`` (Required) The organization name
- `id` (String) ID of the Organization.

### Read-Only

## Attributes Reference
- `created_at` (String) The string time that the Organization was created.
- `created_timestamp` (Number) The timestamp that the Organization was created.
- `description` (String) The description of the Organization.
- `updated_at` (String) The string time that the Organization was last updated.
- `updated_timestamp` (Number) The timestamp that the Organization was last updated.

The following attributes are exported:

* ``id`` - The ID of the Influx organization.
* ``name`` - The name of the Influx organization.
* ``description`` - The description of the Influx organization.
27 changes: 13 additions & 14 deletions docs/data-sources/ready.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
---
layout: "influxdb-v2"
page_title: "InfluxDB V2: influxdb-v2_ready"
sidebar_current: "docs-influxdb-v2-datasource-ready"
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "influxdb-v2_ready Data Source - terraform-provider-influxdb-v2"
subcategory: ""
description: |-
The influxdb-v2_ready data source returns influxdb status.
---

# influxdb-v2\_ready (Data Source)
# influxdb-v2_ready (Data Source)


The influxdb-v2_ready data source retrieves influxdb instance status information.
If the endpoint server is online, the function will output its URL, otherwise, the field will be empty.

## Example Usage

```hcl
```terraform
data "influxdb-v2_ready" "test" {}
output "influxdb-v2_ready" {
value = data.influxdb-v2_ready.test.output["url"]
value = data.influxdb-v2_ready.test.output["url"]
}
```

## Argument Reference
<!-- schema generated by tfplugindocs -->
## Schema

This data source doesn't support arguments.
### Read-Only

## Attributes Reference
- `id` (String) The ID of this resource.
- `output` (Map of String)

The following attributes are exported:

* ``url`` - The URL of the influx instance (empty if not ready).
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: |-
```terraform
provider "influxdb-v2" {
url = "http://localhost:8086" # changeme
token = "super-secret-admin-token" # changeme
token = "WLCq15HS_zugineJalPUqxTxxBKK7IluEseKR0rD3-2CfHBdS0BguLHGEaXRnJ2p080EdTsx9yKq1kFnLnSaxA==" # changeme
}
```

Expand Down
65 changes: 43 additions & 22 deletions docs/resources/authorization.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
layout: "influxdb-v2"
page_title: "InfluxDB V2: influxdb-v2_authorization"
sidebar_current: "docs-influxdb-v2-resource-authorization"
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "influxdb-v2_authorization Resource - terraform-provider-influxdb-v2"
subcategory: ""
description: |-
The influxdb-v2_authorization resource manages influxdb v2 authorizations.
---

# influxdb-v2_authorization (Resource)
Expand Down Expand Up @@ -41,29 +41,50 @@ resource "influxdb-v2_authorization" "example_authorization" {
}
```

## Argument Reference
<!-- schema generated by tfplugindocs -->
## Schema

The following arguments are supported:
### Required

* ``org_id`` (Required) The organization id to which the authorization will be linked.
* ``permissions`` (Required) Permission array of the authorization.
* ``action`` (Required) Action of the permission, can be "read" or "write".
* ``resource`` (Required) Permission resource
* ``id`` (Required) ID of the resource to which the permission is linked
* ``orgID`` (Required) Organization ID to link to.
* ``type`` (Required) The type of authorization, can be `authorizations` `buckets` `dashboards` `orgs` `sources` `tasks` `telegrafs` `users` `variables` `scrapers` `secrets` `labels` `views` `documents` `notificationRules` `notificationEndpoints` `checks` `dbrp`
* ``name`` (Optional) Name of the resource
* ``org`` (Optional) Name of the organization with orgID.
* ``status`` (Optional) Status of the authorization, can be "active" or "inactive" - Default "active"
* ``description`` (Optional) The description of the bucket.
- `org_id` (String)
- `permissions` (Block Set, Min: 1) (see [below for nested schema](#nestedblock--permissions))

## Attributes Reference
### Optional

In addition to the above arguments, the following attributes are exported:
- `description` (String)
- `status` (String)

### Read-Only

- `id` (String) The ID of this resource.
- `token` (String, Sensitive)
- `user_id` (String)
- `user_org_id` (String)

<a id="nestedblock--permissions"></a>
### Nested Schema for `permissions`

Required:

- `action` (String)
- `resource` (Block Set, Min: 1) (see [below for nested schema](#nestedblock--permissions--resource))

<a id="nestedblock--permissions--resource"></a>
### Nested Schema for `permissions.resource`

Required:

- `org_id` (String)
- `type` (String)

Optional:

- `org` (String)

Read-Only:

- `id` (String) The ID of this resource.

* ``user_id`` - The user ID which is created with the authorization.
* ``user_org_id`` - The org ID linked to the user of that authorization.
* ``token`` - The token newly created.
## Import

Import is supported using the following syntax:
Expand Down
Loading

0 comments on commit 568122c

Please sign in to comment.