Skip to content

Commit

Permalink
Merge pull request #8 from komminarlabs/tk/v1.2.1
Browse files Browse the repository at this point in the history
added support for `partition_template`
  • Loading branch information
thulasirajkomminar committed Aug 21, 2024
2 parents 1a72099 + 023bb22 commit 666dbf5
Show file tree
Hide file tree
Showing 31 changed files with 1,227 additions and 47 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
CHANGELOG
=========

## [1.2.1] - 2024-08-21

### Added:

* Added [partition_template](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/custom-partitions/partition-templates/) support. **Note:** Database and table partitions can only be defined on create. You [cannot update the partition strategy](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/databases/create/#partition-templates-can-only-be-applied-on-create) of a database or table after it has been created. An update will result in resource replacement.

## [1.0.1] - 2024-08-13

### Updated:

- Support new [terraform provider version](https://github.com/komminarlabs/terraform-provider-influxdb3/releases/tag/v1.0.1).
- Updated readme

## [1.0.0] - 2024-08-05

Initial release of the provider
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PROJECT := github.com/komminarlabs/pulumi-influxdb3
NODE_MODULE_NAME := @komminarlabs/influxdb3
TF_NAME := influxdb3
PROVIDER_PATH := provider
PROVIDER_VERSION := 1.0.1
PROVIDER_VERSION := 1.2.1
VERSION_PATH := ${PROVIDER_PATH}/pkg/version.Version

TFGEN := pulumi-tfgen-influxdb3
Expand Down
4 changes: 4 additions & 0 deletions docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The InfluxDB V3 provider for Pulumi can be used to provision the resources avail

The InfluxDB V3 provider must be configured with credentials to deploy and update resources in InfluxDB; see [Installation & Configuration](./installation-configuration) for instructions.

## Supported InfluxDB flavours

* [InfluxDB Cloud Dedicated](https://www.influxdata.com/products/influxdb-cloud/dedicated/)

## Example

{{< chooser language "typescript,python,go" >}}
Expand Down
23 changes: 20 additions & 3 deletions provider/cmd/pulumi-resource-influxdb3/bridge-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
"resources": {
"influxdb3_database": {
"current": "influxdb3:index/database:Database",
"majorVersion": 1
"majorVersion": 1,
"fields": {
"partition_template": {
"maxItemsOne": false
}
}
},
"influxdb3_token": {
"current": "influxdb3:index/token:Token",
Expand All @@ -18,14 +23,26 @@
"datasources": {
"influxdb3_database": {
"current": "influxdb3:index/getDatabase:getDatabase",
"majorVersion": 1
"majorVersion": 1,
"fields": {
"partition_template": {
"maxItemsOne": false
}
}
},
"influxdb3_databases": {
"current": "influxdb3:index/getDatabases:getDatabases",
"majorVersion": 1,
"fields": {
"databases": {
"maxItemsOne": false
"maxItemsOne": false,
"elem": {
"fields": {
"partition_template": {
"maxItemsOne": false
}
}
}
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion provider/cmd/pulumi-resource-influxdb3/schema-embed.json

Large diffs are not rendered by default.

107 changes: 103 additions & 4 deletions provider/cmd/pulumi-resource-influxdb3/schema.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ require (
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/komminarlabs/influxdb3 v0.1.0 // indirect
github.com/komminarlabs/terraform-provider-influxdb3 v1.0.1 // indirect
github.com/komminarlabs/terraform-provider-influxdb3 v1.2.1 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand Down
4 changes: 2 additions & 2 deletions provider/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1357,8 +1357,8 @@ github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQs
github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM=
github.com/komminarlabs/influxdb3 v0.1.0 h1:C/Ka8mzYABMXZIAjvZYw+ZXlk0jo6u9shJ7vPgKoseo=
github.com/komminarlabs/influxdb3 v0.1.0/go.mod h1:yEFMuSRwwd1/nO9tKtc1HapjEm5h1Ac/3+or3ckkURE=
github.com/komminarlabs/terraform-provider-influxdb3 v1.0.1 h1:ZVPHZvFPuclTBp+86JvcElc4L0gGYA0+GK4ZWE5zxgA=
github.com/komminarlabs/terraform-provider-influxdb3 v1.0.1/go.mod h1:w8P/TgdYA5dtoba+5ELEzXEzz8gEiqmcfPFJ3gtEUuU=
github.com/komminarlabs/terraform-provider-influxdb3 v1.2.1 h1:DHRUMPfoqis7GcsJTiK8xc68WE/UxKmHzkHrZ4w5Rvs=
github.com/komminarlabs/terraform-provider-influxdb3 v1.2.1/go.mod h1:w8P/TgdYA5dtoba+5ELEzXEzz8gEiqmcfPFJ3gtEUuU=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
Expand Down
2 changes: 1 addition & 1 deletion provider/shim/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.2

require (
github.com/hashicorp/terraform-plugin-framework v1.11.0
github.com/komminarlabs/terraform-provider-influxdb3 v1.0.1
github.com/komminarlabs/terraform-provider-influxdb3 v1.2.1
)

require (
Expand Down
4 changes: 2 additions & 2 deletions provider/shim/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbg
github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE=
github.com/komminarlabs/influxdb3 v0.1.0 h1:C/Ka8mzYABMXZIAjvZYw+ZXlk0jo6u9shJ7vPgKoseo=
github.com/komminarlabs/influxdb3 v0.1.0/go.mod h1:yEFMuSRwwd1/nO9tKtc1HapjEm5h1Ac/3+or3ckkURE=
github.com/komminarlabs/terraform-provider-influxdb3 v1.0.1 h1:ZVPHZvFPuclTBp+86JvcElc4L0gGYA0+GK4ZWE5zxgA=
github.com/komminarlabs/terraform-provider-influxdb3 v1.0.1/go.mod h1:w8P/TgdYA5dtoba+5ELEzXEzz8gEiqmcfPFJ3gtEUuU=
github.com/komminarlabs/terraform-provider-influxdb3 v1.2.1 h1:DHRUMPfoqis7GcsJTiK8xc68WE/UxKmHzkHrZ4w5Rvs=
github.com/komminarlabs/terraform-provider-influxdb3 v1.2.1/go.mod h1:w8P/TgdYA5dtoba+5ELEzXEzz8gEiqmcfPFJ3gtEUuU=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
Expand Down
82 changes: 79 additions & 3 deletions sdk/dotnet/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,52 @@ namespace KomminarLabs.InfluxDB3
{
/// <summary>
/// Creates and manages a database.
///
/// ## Example Usage
///
/// ```csharp
/// using System.Collections.Generic;
/// using System.Linq;
/// using System.Text.Json;
/// using Pulumi;
/// using InfluxDB3 = KomminarLabs.InfluxDB3;
///
/// return await Deployment.RunAsync(() =&gt;
/// {
/// var signals = new InfluxDB3.Database("signals", new()
/// {
/// RetentionPeriod = 604800,
/// PartitionTemplates = new[]
/// {
/// new InfluxDB3.Inputs.DatabasePartitionTemplateArgs
/// {
/// Type = "tag",
/// Value = "line",
/// },
/// new InfluxDB3.Inputs.DatabasePartitionTemplateArgs
/// {
/// Type = "tag",
/// Value = "station",
/// },
/// new InfluxDB3.Inputs.DatabasePartitionTemplateArgs
/// {
/// Type = "time",
/// Value = "%Y-%m-%d",
/// },
/// new InfluxDB3.Inputs.DatabasePartitionTemplateArgs
/// {
/// Type = "bucket",
/// Value = JsonSerializer.Serialize(new Dictionary&lt;string, object?&gt;
/// {
/// ["tagName"] = "temperature",
/// ["numberOfBuckets"] = 10,
/// }),
/// },
/// },
/// });
///
/// });
/// ```
/// </summary>
[InfluxDB3ResourceType("influxdb3:index/database:Database")]
public partial class Database : global::Pulumi.CustomResource
Expand Down Expand Up @@ -41,11 +87,17 @@ public partial class Database : global::Pulumi.CustomResource
public Output<int> MaxTables { get; private set; } = null!;

/// <summary>
/// The name of the cluster database. The Length should be between `[ 1 .. 64 ]` characters. **Note:** Database names can't be updated. After a database is deleted, you cannot [reuse](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/databases/delete/#cannot-reuse-database-names) the same name for a new database.
/// The name of the cluster database. The Length should be between `[ 1 .. 64 ]` characters. **Note:** Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot [reuse](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/databases/delete/#cannot-reuse-database-names) the same name for a new database.
/// </summary>
[Output("name")]
public Output<string> Name { get; private set; } = null!;

/// <summary>
/// A template for [partitioning](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/custom-partitions/partition-templates/) a cluster database. **Note:** A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You [can't update a partition template](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/databases/create/#partition-templates-can-only-be-applied-on-create) on an existing database. An update will result in resource replacement.
/// </summary>
[Output("partitionTemplates")]
public Output<ImmutableArray<Outputs.DatabasePartitionTemplate>> PartitionTemplates { get; private set; } = null!;

/// <summary>
/// The retention period of the cluster database in nanoseconds. The default is `0`. If the retention period is not set or is set to `0`, the database will have infinite retention.
/// </summary>
Expand Down Expand Up @@ -112,11 +164,23 @@ public sealed class DatabaseArgs : global::Pulumi.ResourceArgs
public Input<int>? MaxTables { get; set; }

/// <summary>
/// The name of the cluster database. The Length should be between `[ 1 .. 64 ]` characters. **Note:** Database names can't be updated. After a database is deleted, you cannot [reuse](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/databases/delete/#cannot-reuse-database-names) the same name for a new database.
/// The name of the cluster database. The Length should be between `[ 1 .. 64 ]` characters. **Note:** Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot [reuse](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/databases/delete/#cannot-reuse-database-names) the same name for a new database.
/// </summary>
[Input("name")]
public Input<string>? Name { get; set; }

[Input("partitionTemplates")]
private InputList<Inputs.DatabasePartitionTemplateArgs>? _partitionTemplates;

/// <summary>
/// A template for [partitioning](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/custom-partitions/partition-templates/) a cluster database. **Note:** A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You [can't update a partition template](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/databases/create/#partition-templates-can-only-be-applied-on-create) on an existing database. An update will result in resource replacement.
/// </summary>
public InputList<Inputs.DatabasePartitionTemplateArgs> PartitionTemplates
{
get => _partitionTemplates ?? (_partitionTemplates = new InputList<Inputs.DatabasePartitionTemplateArgs>());
set => _partitionTemplates = value;
}

/// <summary>
/// The retention period of the cluster database in nanoseconds. The default is `0`. If the retention period is not set or is set to `0`, the database will have infinite retention.
/// </summary>
Expand Down Expand Up @@ -156,11 +220,23 @@ public sealed class DatabaseState : global::Pulumi.ResourceArgs
public Input<int>? MaxTables { get; set; }

/// <summary>
/// The name of the cluster database. The Length should be between `[ 1 .. 64 ]` characters. **Note:** Database names can't be updated. After a database is deleted, you cannot [reuse](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/databases/delete/#cannot-reuse-database-names) the same name for a new database.
/// The name of the cluster database. The Length should be between `[ 1 .. 64 ]` characters. **Note:** Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot [reuse](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/databases/delete/#cannot-reuse-database-names) the same name for a new database.
/// </summary>
[Input("name")]
public Input<string>? Name { get; set; }

[Input("partitionTemplates")]
private InputList<Inputs.DatabasePartitionTemplateGetArgs>? _partitionTemplates;

/// <summary>
/// A template for [partitioning](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/custom-partitions/partition-templates/) a cluster database. **Note:** A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You [can't update a partition template](https://docs.influxdata.com/influxdb/cloud-dedicated/admin/databases/create/#partition-templates-can-only-be-applied-on-create) on an existing database. An update will result in resource replacement.
/// </summary>
public InputList<Inputs.DatabasePartitionTemplateGetArgs> PartitionTemplates
{
get => _partitionTemplates ?? (_partitionTemplates = new InputList<Inputs.DatabasePartitionTemplateGetArgs>());
set => _partitionTemplates = value;
}

/// <summary>
/// The retention period of the cluster database in nanoseconds. The default is `0`. If the retention period is not set or is set to `0`, the database will have infinite retention.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions sdk/dotnet/GetDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public sealed class GetDatabaseResult
/// </summary>
public readonly string Name;
/// <summary>
/// The template partitioning of the cluster database.
/// </summary>
public readonly ImmutableArray<Outputs.GetDatabasePartitionTemplateResult> PartitionTemplates;
/// <summary>
/// The retention period of the cluster database in nanoseconds.
/// </summary>
public readonly int RetentionPeriod;
Expand All @@ -101,6 +105,8 @@ private GetDatabaseResult(

string name,

ImmutableArray<Outputs.GetDatabasePartitionTemplateResult> partitionTemplates,

int retentionPeriod)
{
AccountId = accountId;
Expand All @@ -109,6 +115,7 @@ private GetDatabaseResult(
MaxColumnsPerTable = maxColumnsPerTable;
MaxTables = maxTables;
Name = name;
PartitionTemplates = partitionTemplates;
RetentionPeriod = retentionPeriod;
}
}
Expand Down
33 changes: 33 additions & 0 deletions sdk/dotnet/Inputs/DatabasePartitionTemplateArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
using Pulumi;

namespace KomminarLabs.InfluxDB3.Inputs
{

public sealed class DatabasePartitionTemplateArgs : global::Pulumi.ResourceArgs
{
/// <summary>
/// The type of template part. Valid values are `bucket`, `tag` or `time`.
/// </summary>
[Input("type", required: true)]
public Input<string> Type { get; set; } = null!;

/// <summary>
/// The value of template part. **Note:** For `bucket` partition template type use `jsonencode()` function to encode the value to a string.
/// </summary>
[Input("value", required: true)]
public Input<string> Value { get; set; } = null!;

public DatabasePartitionTemplateArgs()
{
}
public static new DatabasePartitionTemplateArgs Empty => new DatabasePartitionTemplateArgs();
}
}
33 changes: 33 additions & 0 deletions sdk/dotnet/Inputs/DatabasePartitionTemplateGetArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
using Pulumi;

namespace KomminarLabs.InfluxDB3.Inputs
{

public sealed class DatabasePartitionTemplateGetArgs : global::Pulumi.ResourceArgs
{
/// <summary>
/// The type of template part. Valid values are `bucket`, `tag` or `time`.
/// </summary>
[Input("type", required: true)]
public Input<string> Type { get; set; } = null!;

/// <summary>
/// The value of template part. **Note:** For `bucket` partition template type use `jsonencode()` function to encode the value to a string.
/// </summary>
[Input("value", required: true)]
public Input<string> Value { get; set; } = null!;

public DatabasePartitionTemplateGetArgs()
{
}
public static new DatabasePartitionTemplateGetArgs Empty => new DatabasePartitionTemplateGetArgs();
}
}
36 changes: 36 additions & 0 deletions sdk/dotnet/Outputs/DatabasePartitionTemplate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
using Pulumi;

namespace KomminarLabs.InfluxDB3.Outputs
{

[OutputType]
public sealed class DatabasePartitionTemplate
{
/// <summary>
/// The type of template part. Valid values are `bucket`, `tag` or `time`.
/// </summary>
public readonly string Type;
/// <summary>
/// The value of template part. **Note:** For `bucket` partition template type use `jsonencode()` function to encode the value to a string.
/// </summary>
public readonly string Value;

[OutputConstructor]
private DatabasePartitionTemplate(
string type,

string value)
{
Type = type;
Value = value;
}
}
}
Loading

0 comments on commit 666dbf5

Please sign in to comment.