Skip to content

Commit

Permalink
Support AutoName for Plugin Framework based resources (#2661)
Browse files Browse the repository at this point in the history
Support AutoName for Plugin Framework based resources. The following resources will receive a Pulumi-generated value in their "name" argument if none is specified by the user. The value will be based on the resource name from the user program followed by a random suffix:

```
resource:aws_appconfig_environment
resource:aws_auditmanager_assessment
resource:aws_auditmanager_assessment_report
resource:aws_auditmanager_control
resource:aws_auditmanager_framework
resource:aws_cognito_user_pool_client
resource:aws_opensearchserverless_access_policy
resource:aws_opensearchserverless_collection
resource:aws_opensearchserverless_security_config
resource:aws_opensearchserverless_security_policy
resource:aws_opensearchserverless_vpc_endpoint
resource:aws_quicksight_vpc_connection
resource:aws_resourceexplorer2_view
resource:aws_route53_cidr_collection
resource:aws_route53_cidr_location
resource:aws_simpledb_domain
```
  • Loading branch information
t0yv0 authored Aug 4, 2023
1 parent cd78209 commit 83a290d
Show file tree
Hide file tree
Showing 192 changed files with 948 additions and 1,524 deletions.
10 changes: 4 additions & 6 deletions examples/plugin-framework/Pulumi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ outputs: {}
resources:
bucket-example:
type: aws:s3:Bucket
resourceexplorer-example:
type: aws:resourceexplorer/index:Index
properties:
type: LOCAL

# cidrcollection also tests auto-naming, it should get a random-suffixed name such as below, without specifying one:
# "name": "cidrcollection-example-8eb4b3b"

cidrcollection-example:
type: aws:route53/cidrCollection:CidrCollection
properties:
name: collection-example
variables: {}
117 changes: 39 additions & 78 deletions provider/cmd/pulumi-resource-aws/schema.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require (
github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.32
github.com/hashicorp/terraform-provider-aws/shim v0.0.0
github.com/mitchellh/go-homedir v1.1.0
github.com/pulumi/pulumi-terraform-bridge/pf v0.14.1
github.com/pulumi/pulumi-terraform-bridge/v3 v3.55.0
github.com/pulumi/pulumi-terraform-bridge/pf v0.15.0
github.com/pulumi/pulumi-terraform-bridge/v3 v3.56.0
github.com/pulumi/pulumi/pkg/v3 v3.76.1
github.com/pulumi/pulumi/sdk/v3 v3.76.1
github.com/stretchr/testify v1.8.4
Expand Down
8 changes: 4 additions & 4 deletions provider/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2278,11 +2278,11 @@ github.com/prometheus/prometheus v0.37.0/go.mod h1:egARUgz+K93zwqsVIAneFlLZefyGO
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/pulumi/pulumi-java/pkg v0.9.4 h1:gIQZmlUI1o9ye8CL2XFqtmAX6Lwr9uj/+HzjboiSmK4=
github.com/pulumi/pulumi-java/pkg v0.9.4/go.mod h1:c6rSw/+q4O0IImgJ9axxoC6QesbPYWBaG5gimbHouUQ=
github.com/pulumi/pulumi-terraform-bridge/pf v0.14.1 h1:5rUx8yFHic576DVHVGOqpYxEcoDyjuokuh8324aFP4c=
github.com/pulumi/pulumi-terraform-bridge/pf v0.14.1/go.mod h1:JnLxW6/U/BGCVdOqsPtPxnIumHp26wqsZv3Ywtgbdl8=
github.com/pulumi/pulumi-terraform-bridge/pf v0.15.0 h1:9ODws24rjbjCUezcBqGeq0Zv4MnE5fsD9MOExHdQbE4=
github.com/pulumi/pulumi-terraform-bridge/pf v0.15.0/go.mod h1:78zmO88vcJDcWoCJZfaHAQReHTEhuNx6BxlE5MUlLJc=
github.com/pulumi/pulumi-terraform-bridge/testing v0.0.1 h1:SCg1gjfY9N4yn8U8peIUYATifjoDABkyR7H9lmefsfc=
github.com/pulumi/pulumi-terraform-bridge/v3 v3.55.0 h1:A33Ji/QSCYy2Jk5+1BzA5vFmK7Rvq6XFo8jS69QahVo=
github.com/pulumi/pulumi-terraform-bridge/v3 v3.55.0/go.mod h1:ykaml8e6XS/yI9JOcNZ+6gLirs6EWTB0FmjbT+JyEdU=
github.com/pulumi/pulumi-terraform-bridge/v3 v3.56.0 h1:3ga+bvWnGH9+Ukxn24prZovhpIXcU7QRhu8iWzs905o=
github.com/pulumi/pulumi-terraform-bridge/v3 v3.56.0/go.mod h1:ykaml8e6XS/yI9JOcNZ+6gLirs6EWTB0FmjbT+JyEdU=
github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.6 h1:uy8P3aaAbrOrGvytvCb2KsYqZMA9TJiY8IKeVQgNAJo=
github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.6/go.mod h1:uw1IN0Mlvi5SL0cmWzmKqZ+ZDNueRIXkr9aE+XQkrug=
github.com/pulumi/pulumi-yaml v1.1.1 h1:8pyBNIU8+ym0wYpjhsCqN+cutygfK1XbhY2YEeNfyXY=
Expand Down
4 changes: 2 additions & 2 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -6985,8 +6985,6 @@ func Provider() *tfbridge.ProviderInfo {
Docs: &tfbridge.DocInfo{Source: "lb_target_group_attachment.html.markdown"},
})

prov.SetAutonaming(255, "-")

// Add a CSharp-specific override for aws_s3_bucket.bucket.
prov.Resources["aws_s3_bucket_legacy"].Fields["bucket"].CSharpName = "BucketName"

Expand Down Expand Up @@ -7120,5 +7118,7 @@ func Provider() *tfbridge.ProviderInfo {
// Fixes a spurious diff on repeat pulumi up for the aws_wafv2_web_acl resource (pulumi/pulumi#1423).
shimv2.SetInstanceStateStrategy(prov.P.ResourcesMap().Get("aws_wafv2_web_acl"), shimv2.CtyInstanceState)

prov.SetAutonaming(255, "-")

return &prov
}
5 changes: 2 additions & 3 deletions sdk/dotnet/AppIntegrations/DataIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ namespace Pulumi.Aws.AppIntegrations
/// {
/// var example = new Aws.AppIntegrations.DataIntegration("example", new()
/// {
/// Name = "example",
/// Description = "example",
/// KmsKey = aws_kms_key.Test.Arn,
/// SourceUri = "Salesforce://AppFlow/example",
Expand Down Expand Up @@ -163,8 +162,8 @@ public sealed class DataIntegrationArgs : global::Pulumi.ResourceArgs
/// <summary>
/// Specifies the name of the Data Integration.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

/// <summary>
/// A block that defines the name of the data and how often it should be pulled from the source. The Schedule Config block is documented below.
Expand Down
5 changes: 2 additions & 3 deletions sdk/dotnet/Auditmanager/Assessment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace Pulumi.Aws.Auditmanager
/// {
/// var test = new Aws.Auditmanager.Assessment("test", new()
/// {
/// Name = "example",
/// AssessmentReportsDestination = new Aws.Auditmanager.Inputs.AssessmentAssessmentReportsDestinationArgs
/// {
/// Destination = $"s3://{aws_s3_bucket.Test.Id}",
Expand Down Expand Up @@ -205,8 +204,8 @@ public sealed class AssessmentArgs : global::Pulumi.ResourceArgs
/// <summary>
/// Name of the assessment.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

[Input("roles", required: true)]
private InputList<Inputs.AssessmentRoleArgs>? _roles;
Expand Down
5 changes: 2 additions & 3 deletions sdk/dotnet/Auditmanager/AssessmentReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace Pulumi.Aws.Auditmanager
/// {
/// var test = new Aws.Auditmanager.AssessmentReport("test", new()
/// {
/// Name = "example",
/// AssessmentId = aws_auditmanager_assessment.Test.Id,
/// });
///
Expand Down Expand Up @@ -138,8 +137,8 @@ public sealed class AssessmentReportArgs : global::Pulumi.ResourceArgs
/// <summary>
/// Name of the assessment report.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

public AssessmentReportArgs()
{
Expand Down
7 changes: 3 additions & 4 deletions sdk/dotnet/Auditmanager/Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ namespace Pulumi.Aws.Auditmanager
/// SourceType = "MANUAL",
/// },
/// },
/// Name = "example",
/// });
///
/// });
Expand Down Expand Up @@ -119,7 +118,7 @@ public partial class Control : global::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 Control(string name, ControlArgs args, CustomResourceOptions? options = null)
public Control(string name, ControlArgs? args = null, CustomResourceOptions? options = null)
: base("aws:auditmanager/control:Control", name, args ?? new ControlArgs(), MakeResourceOptions(options, ""))
{
}
Expand Down Expand Up @@ -192,8 +191,8 @@ public InputList<Inputs.ControlControlMappingSourceArgs> ControlMappingSources
/// <summary>
/// Name of the control.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

[Input("tags")]
private InputMap<string>? _tags;
Expand Down
7 changes: 3 additions & 4 deletions sdk/dotnet/Auditmanager/Framework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace Pulumi.Aws.Auditmanager
/// {
/// var test = new Aws.Auditmanager.Framework("test", new()
/// {
/// Name = "example",
/// ControlSets = new[]
/// {
/// new Aws.Auditmanager.Inputs.FrameworkControlSetArgs
Expand Down Expand Up @@ -112,7 +111,7 @@ public partial class Framework : global::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 Framework(string name, FrameworkArgs args, CustomResourceOptions? options = null)
public Framework(string name, FrameworkArgs? args = null, CustomResourceOptions? options = null)
: base("aws:auditmanager/framework:Framework", name, args ?? new FrameworkArgs(), MakeResourceOptions(options, ""))
{
}
Expand Down Expand Up @@ -179,8 +178,8 @@ public InputList<Inputs.FrameworkControlSetArgs> ControlSets
/// <summary>
/// Name of the framework.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

[Input("tags")]
private InputMap<string>? _tags;
Expand Down
2 changes: 0 additions & 2 deletions sdk/dotnet/Auditmanager/GetControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public static class GetControl
///
/// var exampleFramework = new Aws.Auditmanager.Framework("exampleFramework", new()
/// {
/// Name = "example",
/// ControlSets = new[]
/// {
/// new Aws.Auditmanager.Inputs.FrameworkControlSetArgs
Expand Down Expand Up @@ -147,7 +146,6 @@ public static Task<GetControlResult> InvokeAsync(GetControlArgs args, InvokeOpti
///
/// var exampleFramework = new Aws.Auditmanager.Framework("exampleFramework", new()
/// {
/// Name = "example",
/// ControlSets = new[]
/// {
/// new Aws.Auditmanager.Inputs.FrameworkControlSetArgs
Expand Down
5 changes: 2 additions & 3 deletions sdk/dotnet/Chime/SdkvoiceSipMediaApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ namespace Pulumi.Aws.Chime
/// var example = new Aws.Chime.SdkvoiceSipMediaApplication("example", new()
/// {
/// AwsRegion = "us-east-1",
/// Name = "example-sip-media-application",
/// Endpoints = new Aws.Chime.Inputs.SdkvoiceSipMediaApplicationEndpointsArgs
/// {
/// LambdaArn = aws_lambda_function.Test.Arn,
Expand Down Expand Up @@ -148,8 +147,8 @@ public sealed class SdkvoiceSipMediaApplicationArgs : global::Pulumi.ResourceArg
///
/// The following arguments are optional:
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

[Input("tags")]
private InputMap<string>? _tags;
Expand Down
5 changes: 2 additions & 3 deletions sdk/dotnet/Chime/SdkvoiceSipRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace Pulumi.Aws.Chime
/// {
/// var example = new Aws.Chime.SdkvoiceSipRule("example", new()
/// {
/// Name = "example-sip-rule",
/// TriggerType = "RequestUriHostname",
/// TriggerValue = aws_chime_voice_connector.Example_voice_connector.Outbound_host_name,
/// TargetApplications = new[]
Expand Down Expand Up @@ -140,8 +139,8 @@ public sealed class SdkvoiceSipRuleArgs : global::Pulumi.ResourceArgs
/// <summary>
/// The name of the SIP rule.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

[Input("targetApplications", required: true)]
private InputList<Inputs.SdkvoiceSipRuleTargetApplicationArgs>? _targetApplications;
Expand Down
5 changes: 2 additions & 3 deletions sdk/dotnet/Chime/SdkvoiceVoiceProfileDomain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ namespace Pulumi.Aws.Chime
///
/// var exampleSdkvoiceVoiceProfileDomain = new Aws.Chime.SdkvoiceVoiceProfileDomain("exampleSdkvoiceVoiceProfileDomain", new()
/// {
/// Name = "ExampleVoiceProfileDomain",
/// ServerSideEncryptionConfiguration = new Aws.Chime.Inputs.SdkvoiceVoiceProfileDomainServerSideEncryptionConfigurationArgs
/// {
/// KmsKeyArn = exampleKey.Arn,
Expand Down Expand Up @@ -142,8 +141,8 @@ public sealed class SdkvoiceVoiceProfileDomainArgs : global::Pulumi.ResourceArgs
/// <summary>
/// Name of Voice Profile Domain.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

/// <summary>
/// Configuration for server side encryption.
Expand Down
5 changes: 2 additions & 3 deletions sdk/dotnet/CleanRooms/Collaboration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ namespace Pulumi.Aws.CleanRooms
/// MemberAbilities = new[] {},
/// },
/// },
/// Name = "pulumi-example-collaboration",
/// QueryLogStatus = "DISABLED",
/// Tags =
/// {
Expand Down Expand Up @@ -254,8 +253,8 @@ public InputList<Inputs.CollaborationMemberArgs> Members
/// <summary>
/// The name of the collaboration. Collaboration names do not need to be unique.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

/// <summary>
/// Determines if members of the collaboration can enable query logs within their own
Expand Down
1 change: 0 additions & 1 deletion sdk/dotnet/CloudFront/FieldLevelEncryptionProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ namespace Pulumi.Aws.CloudFront
/// {
/// Comment = "test public key",
/// EncodedKey = File.ReadAllText("public_key.pem"),
/// Name = "test_key",
/// });
///
/// var test = new Aws.CloudFront.FieldLevelEncryptionProfile("test", new()
Expand Down
1 change: 0 additions & 1 deletion sdk/dotnet/CloudFront/KeyGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ namespace Pulumi.Aws.CloudFront
/// {
/// Comment = "example public key",
/// EncodedKey = File.ReadAllText("public_key.pem"),
/// Name = "example-key",
/// });
///
/// var exampleKeyGroup = new Aws.CloudFront.KeyGroup("exampleKeyGroup", new()
Expand Down
1 change: 0 additions & 1 deletion sdk/dotnet/CloudFront/PublicKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ namespace Pulumi.Aws.CloudFront
/// {
/// Comment = "test public key",
/// EncodedKey = File.ReadAllText("public_key.pem"),
/// Name = "test_key",
/// });
///
/// });
Expand Down
5 changes: 2 additions & 3 deletions sdk/dotnet/EmrContainers/JobTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ namespace Pulumi.Aws.EmrContainers
/// },
/// },
/// },
/// Name = "example",
/// });
///
/// });
Expand Down Expand Up @@ -151,8 +150,8 @@ public sealed class JobTemplateArgs : global::Pulumi.ResourceArgs
/// <summary>
/// The specified name of the job template.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

[Input("tags")]
private InputMap<string>? _tags;
Expand Down
4 changes: 2 additions & 2 deletions sdk/dotnet/FinSpace/KxCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ public InputList<Inputs.KxClusterDatabaseArgs> Databases
/// <summary>
/// Unique name for the cluster that you want to create.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

/// <summary>
/// Version of FinSpace Managed kdb to run.
Expand Down
6 changes: 2 additions & 4 deletions sdk/dotnet/FinSpace/KxDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ namespace Pulumi.Aws.FinSpace
///
/// var exampleKxEnvironment = new Aws.FinSpace.KxEnvironment("exampleKxEnvironment", new()
/// {
/// Name = "my-tf-kx-environment",
/// KmsKeyId = exampleKey.Arn,
/// });
///
/// var exampleKxDatabase = new Aws.FinSpace.KxDatabase("exampleKxDatabase", new()
/// {
/// EnvironmentId = exampleKxEnvironment.Id,
/// Name = "my-tf-kx-database",
/// Description = "Example database description",
/// });
///
Expand Down Expand Up @@ -169,8 +167,8 @@ public sealed class KxDatabaseArgs : global::Pulumi.ResourceArgs
///
/// The following arguments are optional:
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

[Input("tags")]
private InputMap<string>? _tags;
Expand Down
6 changes: 2 additions & 4 deletions sdk/dotnet/FinSpace/KxEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ namespace Pulumi.Aws.FinSpace
///
/// var exampleKxEnvironment = new Aws.FinSpace.KxEnvironment("exampleKxEnvironment", new()
/// {
/// Name = "my-tf-kx-environment",
/// KmsKeyId = exampleKey.Arn,
/// });
///
Expand Down Expand Up @@ -60,7 +59,6 @@ namespace Pulumi.Aws.FinSpace
///
/// var exampleEnv = new Aws.FinSpace.KxEnvironment("exampleEnv", new()
/// {
/// Name = "my-tf-kx-environment",
/// Description = "Environment description",
/// KmsKeyId = exampleKey.Arn,
/// TransitGatewayConfiguration = new Aws.FinSpace.Inputs.KxEnvironmentTransitGatewayConfigurationArgs
Expand Down Expand Up @@ -247,8 +245,8 @@ public InputList<Inputs.KxEnvironmentCustomDnsConfigurationArgs> CustomDnsConfig
/// <summary>
/// Name of the KX environment that you want to create.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

[Input("tags")]
private InputMap<string>? _tags;
Expand Down
6 changes: 2 additions & 4 deletions sdk/dotnet/FinSpace/KxUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ namespace Pulumi.Aws.FinSpace
///
/// var exampleKxEnvironment = new Aws.FinSpace.KxEnvironment("exampleKxEnvironment", new()
/// {
/// Name = "my-tf-kx-environment",
/// KmsKeyId = exampleKey.Arn,
/// });
///
Expand All @@ -59,7 +58,6 @@ namespace Pulumi.Aws.FinSpace
///
/// var exampleKxUser = new Aws.FinSpace.KxUser("exampleKxUser", new()
/// {
/// Name = "my-tf-kx-user",
/// EnvironmentId = exampleKxEnvironment.Id,
/// IamRole = exampleRole.Arn,
/// });
Expand Down Expand Up @@ -179,8 +177,8 @@ public sealed class KxUserArgs : global::Pulumi.ResourceArgs
/// <summary>
/// A unique identifier for the user.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
[Input("name")]
public Input<string>? Name { get; set; }

[Input("tags")]
private InputMap<string>? _tags;
Expand Down
Loading

0 comments on commit 83a290d

Please sign in to comment.