Skip to content

Commit

Permalink
Fix autonaming on Environment resource (#10)
Browse files Browse the repository at this point in the history
* Fix autonaming on Environment resource

* Fix autonaming on Acl, Cluster, ServiceAccount, and ApiKey resources. Generate scheam and SDKs.

* fixed a typo to unstick the actions I hope
  • Loading branch information
guineveresaenger authored Aug 10, 2022
1 parent 69d9a2f commit 6c48d05
Show file tree
Hide file tree
Showing 40 changed files with 113 additions and 184 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
The Confluent Resource Provider lets you manage [Confluent](https://confluent.cloud/) resources.

Please Note:
This provider is build from the ConfluentInc official Terraform Provider - https://github.com/confluentinc/terraform-provider-confluent
This provider is built from the ConfluentInc official Terraform Provider - https://github.com/confluentinc/terraform-provider-confluent

## Installing

Expand Down
9 changes: 1 addition & 8 deletions examples/basic-kafka-acls/py/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import pulumi_confluentcloud as confluent


environment = confluent.Environment("py-staging", display_name="Staging")
environment = confluent.Environment("py-staging")

# Create the basic cluster.
cluster = confluent.KafkaCluster("basic-cluster",
display_name="inventory",
availability="SINGLE_ZONE",
cloud="AWS",
region="us-west-2",
Expand All @@ -25,7 +24,6 @@
# Create a service account that will be used to manage the cluster
# and bind the CloudClusterAdmin to it.
app_manager = confluent.ServiceAccount("app-manager",
display_name="app-manager",
description="Service account to manage 'inventory' Kafka cluster")

cluster_admin_role_binding = confluent.RoleBinding("app-manager-kafka-cluster-admin",
Expand All @@ -38,7 +36,6 @@
app_manager_api_key_owner = confluent.ApiKeyOwnerArgs(
id=app_manager.id, api_version=app_manager.api_version, kind=app_manager.kind)
app_manager_api_key = confluent.ApiKey("app-manager-kafka-api-key",
display_name="app-manager-kafka-api-key",
owner=app_manager_api_key_owner,
managed_resource=cluster_managed_resource,
opts=pulumi.ResourceOptions(
Expand All @@ -60,23 +57,19 @@

# Create the producer service account and an API key for it.
app_producer = confluent.ServiceAccount("app-producer",
display_name="app-producer",
description="Service account to produce to 'orders' topic of 'inventory' Kafka cluster")

app_producer_api_key = confluent.ApiKey("app-producer-kafka-api-key",
display_name="app-producer-kafka-api-key",
owner=confluent.ApiKeyOwnerArgs(id=app_producer.id,
api_version=app_producer.api_version,
kind=app_producer.kind),
managed_resource=cluster_managed_resource)

# Create the consumer service account and an API key for it.
app_consumer = confluent.ServiceAccount("app-consumer",
display_name="app-consumer",
description="Service account to consume from 'orders' topic of 'inventory' Kafka cluster")

app_consumer_api_key = confluent.ApiKey("app-consumer-kafka-api-key",
display_name="app-consumer-kafka-api-key",
owner=confluent.ApiKeyOwnerArgs(id=app_consumer.id,
api_version=app_consumer.api_version,
kind=app_consumer.kind),
Expand Down
8 changes: 1 addition & 7 deletions examples/environment/dotnet/MyStack.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
using Pulumi;
using Pulumi.ConfluentCloud;
using Pulumi.Random;

class MyStack : Stack
{
public MyStack()
{
var petName = new RandomPet("dotnet-environment");

var environment = new Pulumi.ConfluentCloud.Environment("dotnet-environment", new Pulumi.ConfluentCloud.EnvironmentArgs
{
DisplayName = petName.Id,
});
var environment = new Pulumi.ConfluentCloud.Environment("dotnet-environment");
}
}
5 changes: 1 addition & 4 deletions examples/environment/py/__main__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
"""A Python Pulumi program"""

import pulumi
import pulumi_random as random
import pulumi_confluentcloud as confluent

pet_name = random.RandomPet("py-environment")

environment = confluent.Environment("py-environment", display_name=pet_name.id)
environment = confluent.Environment("py-environment")
7 changes: 1 addition & 6 deletions examples/environment/ts/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
import * as confluent from "@pulumi/confluentcloud";

const petName = new random.RandomPet("environment-name")

const env = new confluent.Environment("ts-env", {
displayName: petName.id,
})
const env = new confluent.Environment("ts-env")
16 changes: 5 additions & 11 deletions provider/cmd/pulumi-resource-confluentcloud/schema.json

Large diffs are not rendered by default.

27 changes: 21 additions & 6 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,32 @@ func Provider() tfbridge.ProviderInfo {
GitHubOrg: "confluentinc",
Config: map[string]*tfbridge.SchemaInfo{},
Resources: map[string]*tfbridge.ResourceInfo{
"confluent_api_key": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "ApiKey")},
"confluent_connector": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "Connector")},
"confluent_environment": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "Environment")},
"confluent_kafka_acl": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "KafkaAcl")},
"confluent_kafka_cluster": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "KafkaCluster")},
"confluent_api_key": {
Tok: tfbridge.MakeResource(mainPkg, mainMod, "ApiKey"),
Fields: map[string]*tfbridge.SchemaInfo{
"display_name": tfbridge.AutoName("displayName", 255, "-"),
}},
"confluent_connector": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "Connector")},
"confluent_environment": {
Tok: tfbridge.MakeResource(mainPkg, mainMod, "Environment"),
Fields: map[string]*tfbridge.SchemaInfo{
"display_name": tfbridge.AutoName("displayName", 255, "-"),
}},
"confluent_kafka_acl": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "KafkaAcl")},
"confluent_kafka_cluster": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "KafkaCluster"),
Fields: map[string]*tfbridge.SchemaInfo{
"display_name": tfbridge.AutoName("displayName", 255, "-"),
}},
"confluent_kafka_topic": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "KafkaTopic")},
"confluent_network": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "Network")},
"confluent_peering": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "Peering")},
"confluent_private_link_access": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "PrivateLinkAccess")},
"confluent_role_binding": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "RoleBinding")},
"confluent_service_account": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "ServiceAccount")},
"confluent_service_account": {
Tok: tfbridge.MakeResource(mainPkg, mainMod, "ServiceAccount"),
Fields: map[string]*tfbridge.SchemaInfo{
"display_name": tfbridge.AutoName("displayName", 255, "-"),
}},
},
DataSources: map[string]*tfbridge.DataSourceInfo{
"confluent_environment": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getEnvironment")},
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/ApiKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public partial class ApiKey : Pulumi.CustomResource
/// A human-readable name for the API Key.
/// </summary>
[Output("displayName")]
public Output<string?> DisplayName { get; private set; } = null!;
public Output<string> DisplayName { get; private set; } = null!;

/// <summary>
/// The resource associated with this object. The only resource that is supported is 'cmk.v2.KafkaCluster'.
Expand Down
6 changes: 3 additions & 3 deletions sdk/dotnet/Environment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public partial class Environment : Pulumi.CustomResource
/// <param name="name">The unique name of the resource</param>
/// <param name="args">The arguments used to populate this resource's properties</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public Environment(string name, EnvironmentArgs args, CustomResourceOptions? options = null)
public Environment(string name, EnvironmentArgs? args = null, CustomResourceOptions? options = null)
: base("confluentcloud:index/environment:Environment", name, args ?? new EnvironmentArgs(), MakeResourceOptions(options, ""))
{
}
Expand Down Expand Up @@ -84,8 +84,8 @@ public sealed class EnvironmentArgs : Pulumi.ResourceArgs
/// <summary>
/// A human-readable name for the Environment. Start and end the name with alphanumeric characters, for example, "Development". The name can contain hyphens and underscores.
/// </summary>
[Input("displayName", required: true)]
public Input<string> DisplayName { get; set; } = null!;
[Input("displayName")]
public Input<string>? DisplayName { get; set; }

public EnvironmentArgs()
{
Expand Down
2 changes: 0 additions & 2 deletions sdk/dotnet/GetKafkaCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public static class GetKafkaCluster
/// }));
/// var test_sa = new ConfluentCloud.ServiceAccount("test-sa", new ConfluentCloud.ServiceAccountArgs
/// {
/// DisplayName = "app_mgr",
/// Description = exampleUsingId.Apply(exampleUsingId =&gt; $"app_mgr for {exampleUsingId.DisplayName}"),
/// });
/// var exampleUsingNameKafkaCluster = Output.Create(ConfluentCloud.GetKafkaCluster.InvokeAsync(new ConfluentCloud.GetKafkaClusterArgs
Expand Down Expand Up @@ -89,7 +88,6 @@ public static Task<GetKafkaClusterResult> InvokeAsync(GetKafkaClusterArgs args,
/// }));
/// var test_sa = new ConfluentCloud.ServiceAccount("test-sa", new ConfluentCloud.ServiceAccountArgs
/// {
/// DisplayName = "app_mgr",
/// Description = exampleUsingId.Apply(exampleUsingId =&gt; $"app_mgr for {exampleUsingId.DisplayName}"),
/// });
/// var exampleUsingNameKafkaCluster = Output.Create(ConfluentCloud.GetKafkaCluster.InvokeAsync(new ConfluentCloud.GetKafkaClusterArgs
Expand Down
2 changes: 0 additions & 2 deletions sdk/dotnet/GetNetwork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public static class GetNetwork
/// }));
/// var test_sa = new ConfluentCloud.ServiceAccount("test-sa", new ConfluentCloud.ServiceAccountArgs
/// {
/// DisplayName = "test_sa",
/// Description = exampleUsingId.Apply(exampleUsingId =&gt; $"test_sa for {exampleUsingId.DisplayName}"),
/// });
/// var exampleUsingNameNetwork = Output.Create(ConfluentCloud.GetNetwork.InvokeAsync(new ConfluentCloud.GetNetworkArgs
Expand Down Expand Up @@ -89,7 +88,6 @@ public static Task<GetNetworkResult> InvokeAsync(GetNetworkArgs args, InvokeOpti
/// }));
/// var test_sa = new ConfluentCloud.ServiceAccount("test-sa", new ConfluentCloud.ServiceAccountArgs
/// {
/// DisplayName = "test_sa",
/// Description = exampleUsingId.Apply(exampleUsingId =&gt; $"test_sa for {exampleUsingId.DisplayName}"),
/// });
/// var exampleUsingNameNetwork = Output.Create(ConfluentCloud.GetNetwork.InvokeAsync(new ConfluentCloud.GetNetworkArgs
Expand Down
2 changes: 0 additions & 2 deletions sdk/dotnet/GetServiceAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public static class GetServiceAccount
/// }));
/// var test_env = new ConfluentCloud.Environment("test-env", new ConfluentCloud.EnvironmentArgs
/// {
/// DisplayName = exampleUsingIdServiceAccount.Apply(exampleUsingIdServiceAccount =&gt; $"env_for_{exampleUsingIdServiceAccount.DisplayName}"),
/// });
/// }
///
Expand Down Expand Up @@ -81,7 +80,6 @@ public static Task<GetServiceAccountResult> InvokeAsync(GetServiceAccountArgs? a
/// }));
/// var test_env = new ConfluentCloud.Environment("test-env", new ConfluentCloud.EnvironmentArgs
/// {
/// DisplayName = exampleUsingIdServiceAccount.Apply(exampleUsingIdServiceAccount =&gt; $"env_for_{exampleUsingIdServiceAccount.DisplayName}"),
/// });
/// }
///
Expand Down
4 changes: 0 additions & 4 deletions sdk/dotnet/GetUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ public static class GetUser
/// }));
/// var test_env = new ConfluentCloud.Environment("test-env", new ConfluentCloud.EnvironmentArgs
/// {
/// DisplayName = exampleUsingIdUser.Apply(exampleUsingIdUser =&gt; $"env_for_{exampleUsingIdUser.FullName}"),
/// });
/// var standard_cluster_on_aws = new ConfluentCloud.KafkaCluster("standard-cluster-on-aws", new ConfluentCloud.KafkaClusterArgs
/// {
/// DisplayName = "standard_kafka_cluster_on_aws",
/// Availability = "SINGLE_ZONE",
/// Cloud = "AWS",
/// Region = "us-west-2",
Expand Down Expand Up @@ -106,11 +104,9 @@ public static Task<GetUserResult> InvokeAsync(GetUserArgs? args = null, InvokeOp
/// }));
/// var test_env = new ConfluentCloud.Environment("test-env", new ConfluentCloud.EnvironmentArgs
/// {
/// DisplayName = exampleUsingIdUser.Apply(exampleUsingIdUser =&gt; $"env_for_{exampleUsingIdUser.FullName}"),
/// });
/// var standard_cluster_on_aws = new ConfluentCloud.KafkaCluster("standard-cluster-on-aws", new ConfluentCloud.KafkaClusterArgs
/// {
/// DisplayName = "standard_kafka_cluster_on_aws",
/// Availability = "SINGLE_ZONE",
/// Cloud = "AWS",
/// Region = "us-west-2",
Expand Down
4 changes: 2 additions & 2 deletions sdk/dotnet/KafkaCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ public InputList<Inputs.KafkaClusterBasicArgs> Basics
/// <summary>
/// The name of the Kafka cluster.
/// </summary>
[Input("displayName", required: true)]
public Input<string> DisplayName { get; set; } = null!;
[Input("displayName")]
public Input<string>? DisplayName { get; set; }

/// <summary>
/// Environment objects represent an isolated namespace for your Confluent resources for organizational purposes.
Expand Down
6 changes: 3 additions & 3 deletions sdk/dotnet/ServiceAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public partial class ServiceAccount : Pulumi.CustomResource
/// <param name="name">The unique name of the resource</param>
/// <param name="args">The arguments used to populate this resource's properties</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public ServiceAccount(string name, ServiceAccountArgs args, CustomResourceOptions? options = null)
public ServiceAccount(string name, ServiceAccountArgs? args = null, CustomResourceOptions? options = null)
: base("confluentcloud:index/serviceAccount:ServiceAccount", name, args ?? new ServiceAccountArgs(), MakeResourceOptions(options, ""))
{
}
Expand Down Expand Up @@ -102,8 +102,8 @@ public sealed class ServiceAccountArgs : Pulumi.ResourceArgs
/// <summary>
/// A human-readable name for the Service Account.
/// </summary>
[Input("displayName", required: true)]
public Input<string> DisplayName { get; set; } = null!;
[Input("displayName")]
public Input<string>? DisplayName { get; set; }

public ServiceAccountArgs()
{
Expand Down
6 changes: 3 additions & 3 deletions sdk/go/confluentcloud/apiKey.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions sdk/go/confluentcloud/environment.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion sdk/go/confluentcloud/getKafkaCluster.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion sdk/go/confluentcloud/getNetwork.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions sdk/go/confluentcloud/getServiceAccount.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions sdk/go/confluentcloud/getUser.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6c48d05

Please sign in to comment.