From 1512b95b63e0930c48ef4c9ed2543cc785ed5231 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Fri, 8 Mar 2024 14:28:40 +0000 Subject: [PATCH] Revert defaultTags schema change - Allow the provider to parse both the old and new schemas for compatability. --- examples/examples_py_test.go | 4 +- provider/cmd/cf2pulumi/schema-full.json | 51 +++++-- .../pulumi-resource-aws-native/schema.json | 51 +++++-- provider/pkg/provider/provider.go | 15 +- provider/pkg/schema/config.go | 31 +++- provider/pkg/schema/gen.go | 6 +- sdk/dotnet/Config/Config.cs | 12 +- sdk/dotnet/Inputs/ProviderDefaultTagsArgs.cs | 35 +++++ sdk/dotnet/Provider.cs | 10 +- sdk/go/aws/config/pulumiTypes.go | 6 + sdk/go/aws/provider.go | 4 +- sdk/go/aws/pulumiTypes.go | 144 ++++++++++++++++++ sdk/nodejs/config/vars.ts | 4 +- sdk/nodejs/provider.ts | 2 +- sdk/nodejs/types/input.ts | 10 ++ sdk/nodejs/types/output.ts | 10 ++ sdk/python/pulumi_aws_native/_inputs.py | 25 +++ .../pulumi_aws_native/config/outputs.py | 24 +++ sdk/python/pulumi_aws_native/provider.py | 14 +- 19 files changed, 398 insertions(+), 60 deletions(-) create mode 100644 sdk/dotnet/Inputs/ProviderDefaultTagsArgs.cs diff --git a/examples/examples_py_test.go b/examples/examples_py_test.go index c31edf560b..79c0ae9a00 100644 --- a/examples/examples_py_test.go +++ b/examples/examples_py_test.go @@ -27,7 +27,9 @@ func TestDefaultTagsPython(t *testing.T) { Dir: filepath.Join(getCwd(t), "default-tags-py"), Config: map[string]string{ "aws-native:defaultTags": `{ - "defaultTag": "defaultTagValue" + "tags": { + "defaultTag": "defaultTagValue" + } }`, }, ExtraRuntimeValidation: func(t *testing.T, stackInfo integration.RuntimeValidationStackInfo) { diff --git a/provider/cmd/cf2pulumi/schema-full.json b/provider/cmd/cf2pulumi/schema-full.json index e4db8a0a10..5c108e5915 100644 --- a/provider/cmd/cf2pulumi/schema-full.json +++ b/provider/cmd/cf2pulumi/schema-full.json @@ -294,10 +294,7 @@ "description": "Configuration for retrieving temporary credentials from the STS service." }, "defaultTags": { - "type": "object", - "additionalProperties": { - "type": "string" - }, + "$ref": "#/types/aws-native:config:DefaultTags", "description": "Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys." }, "endpoints": { @@ -23250,6 +23247,24 @@ }, "type": "object" }, + "aws-native:config:DefaultTags": { + "description": "The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys.", + "properties": { + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A group of tags to set across all resources.", + "language": { + "python": { + "mapCase": false + } + } + } + }, + "type": "object" + }, "aws-native:config:Endpoints": { "description": "The configuration for for customizing service endpoints.", "properties": { @@ -56638,6 +56653,24 @@ }, "type": "object" }, + "aws-native:index:ProviderDefaultTags": { + "description": "The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys.", + "properties": { + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A group of tags to set across all resources.", + "language": { + "python": { + "mapCase": false + } + } + } + }, + "type": "object" + }, "aws-native:index:ProviderEndpoint": { "description": "The configuration for for customizing service endpoints.", "properties": { @@ -153770,10 +153803,7 @@ "description": "Configuration for retrieving temporary credentials from the STS service." }, "defaultTags": { - "type": "object", - "additionalProperties": { - "type": "string" - }, + "$ref": "#/types/aws-native:index:ProviderDefaultTags", "description": "Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys." }, "endpoints": { @@ -153862,10 +153892,7 @@ "description": "Configuration for retrieving temporary credentials from the STS service." }, "defaultTags": { - "type": "object", - "additionalProperties": { - "type": "string" - }, + "$ref": "#/types/aws-native:index:ProviderDefaultTags", "description": "Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys." }, "endpoints": { diff --git a/provider/cmd/pulumi-resource-aws-native/schema.json b/provider/cmd/pulumi-resource-aws-native/schema.json index 1d529b1004..729d474f6d 100644 --- a/provider/cmd/pulumi-resource-aws-native/schema.json +++ b/provider/cmd/pulumi-resource-aws-native/schema.json @@ -265,10 +265,7 @@ "description": "Configuration for retrieving temporary credentials from the STS service." }, "defaultTags": { - "type": "object", - "additionalProperties": { - "type": "string" - }, + "$ref": "#/types/aws-native:config:DefaultTags", "description": "Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys." }, "endpoints": { @@ -18050,6 +18047,24 @@ }, "type": "object" }, + "aws-native:config:DefaultTags": { + "description": "The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys.", + "properties": { + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A group of tags to set across all resources.", + "language": { + "python": { + "mapCase": false + } + } + } + }, + "type": "object" + }, "aws-native:config:Endpoints": { "description": "The configuration for for customizing service endpoints.", "properties": { @@ -45093,6 +45108,24 @@ }, "type": "object" }, + "aws-native:index:ProviderDefaultTags": { + "description": "The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys.", + "properties": { + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A group of tags to set across all resources.", + "language": { + "python": { + "mapCase": false + } + } + } + }, + "type": "object" + }, "aws-native:index:ProviderEndpoint": { "description": "The configuration for for customizing service endpoints.", "properties": { @@ -132914,10 +132947,7 @@ "description": "Configuration for retrieving temporary credentials from the STS service." }, "defaultTags": { - "type": "object", - "additionalProperties": { - "type": "string" - }, + "$ref": "#/types/aws-native:index:ProviderDefaultTags", "description": "Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys." }, "endpoints": { @@ -133006,10 +133036,7 @@ "description": "Configuration for retrieving temporary credentials from the STS service." }, "defaultTags": { - "type": "object", - "additionalProperties": { - "type": "string" - }, + "$ref": "#/types/aws-native:index:ProviderDefaultTags", "description": "Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys." }, "endpoints": { diff --git a/provider/pkg/provider/provider.go b/provider/pkg/provider/provider.go index 05ae4ad54e..e9d573248a 100644 --- a/provider/pkg/provider/provider.go +++ b/provider/pkg/provider/provider.go @@ -461,12 +461,21 @@ func (p *cfnProvider) Configure(ctx context.Context, req *pulumirpc.ConfigureReq } if defaultTagsJson, ok := vars["aws-native:config:defaultTags"]; ok { - var defaultTags map[string]string + type DefaultTags struct { + Tags map[string]string `json:"tags"` + } + var defaultTags DefaultTags err := json.Unmarshal([]byte(defaultTagsJson), &defaultTags) if err != nil { - return nil, fmt.Errorf("failed to unmarshal 'skipCredentialsValidation' config: %w", err) + p.defaultTags = defaultTags.Tags + } else { + // As a fallback, we also try to unmarshal the default tags as a simple map[string]string + // as this was originally supported when implementing defaultTags. + fallbackErr := json.Unmarshal([]byte(defaultTagsJson), &p.defaultTags) + if fallbackErr != nil { + return nil, fmt.Errorf("failed to unmarshal 'defaultTags' config: %w", err) + } } - p.defaultTags = defaultTags } else { p.defaultTags = nil } diff --git a/provider/pkg/schema/config.go b/provider/pkg/schema/config.go index 053a4902cb..3cfd78f0e7 100644 --- a/provider/pkg/schema/config.go +++ b/provider/pkg/schema/config.go @@ -74,6 +74,21 @@ var assumeRole = pschema.ComplexTypeSpec{ }, } +var defaultTags = pschema.ComplexTypeSpec{ + ObjectTypeSpec: pschema.ObjectTypeSpec{ + Description: "The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys.", + Properties: map[string]pschema.PropertySpec{ + "tags": { + Description: "A group of tags to set across all resources.", + TypeSpec: pschema.TypeSpec{ + Type: "object", + AdditionalProperties: &pschema.TypeSpec{Type: "string"}}, + }, + }, + Type: "object", + }, +} + var endpoints = pschema.ComplexTypeSpec{ ObjectTypeSpec: pschema.ObjectTypeSpec{ Description: "The configuration for for customizing service endpoints.", @@ -156,11 +171,13 @@ var region = pschema.ComplexTypeSpec{ // typeOverlays augment the types defined by the schema. var typeOverlays = map[string]pschema.ComplexTypeSpec{ - "aws-native:config:AssumeRole": assumeRole, - "aws-native:index:ProviderAssumeRole": configToProvider(assumeRole), - "aws-native:config:Endpoints": endpoints, - "aws-native:index:ProviderEndpoint": configToProvider(endpoints), - "aws-native:config:IgnoreTags": ignoreTags, - "aws-native:index:ProviderIgnoreTags": configToProvider(ignoreTags), - "aws-native:index/Region:Region": region, + "aws-native:config:AssumeRole": assumeRole, + "aws-native:index:ProviderAssumeRole": configToProvider(assumeRole), + "aws-native:config:DefaultTags": defaultTags, + "aws-native:index:ProviderDefaultTags": configToProvider(defaultTags), + "aws-native:config:Endpoints": endpoints, + "aws-native:index:ProviderEndpoint": configToProvider(endpoints), + "aws-native:config:IgnoreTags": ignoreTags, + "aws-native:index:ProviderIgnoreTags": configToProvider(ignoreTags), + "aws-native:index/Region:Region": region, } diff --git a/provider/pkg/schema/gen.go b/provider/pkg/schema/gen.go index 9ae0ad2542..34f7045450 100644 --- a/provider/pkg/schema/gen.go +++ b/provider/pkg/schema/gen.go @@ -79,7 +79,7 @@ func GatherPackage(supportedResourceTypes []string, jsonSchemas []jsschema.Schem }, "defaultTags": { Description: "Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys.", - TypeSpec: pschema.TypeSpec{Type: "object", AdditionalProperties: &pschema.TypeSpec{Type: "string"}}, + TypeSpec: pschema.TypeSpec{Ref: "#/types/aws-native:config:DefaultTags"}, }, "endpoints": { Description: "Configuration block for customizing service endpoints.", @@ -177,7 +177,7 @@ func GatherPackage(supportedResourceTypes []string, jsonSchemas []jsschema.Schem }, "defaultTags": { Description: "Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys.", - TypeSpec: pschema.TypeSpec{Type: "object", AdditionalProperties: &pschema.TypeSpec{Type: "string"}}, + TypeSpec: pschema.TypeSpec{Ref: "#/types/aws-native:index:ProviderDefaultTags"}, }, "endpoints": { Description: "Configuration block for customizing service endpoints.", @@ -260,7 +260,7 @@ func GatherPackage(supportedResourceTypes []string, jsonSchemas []jsschema.Schem }, "defaultTags": { Description: "Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys.", - TypeSpec: pschema.TypeSpec{Type: "object", AdditionalProperties: &pschema.TypeSpec{Type: "string"}}, + TypeSpec: pschema.TypeSpec{Ref: "#/types/aws-native:index:ProviderDefaultTags"}, }, "endpoints": { Description: "Configuration block for customizing service endpoints.", diff --git a/sdk/dotnet/Config/Config.cs b/sdk/dotnet/Config/Config.cs index a3c2cd2139..6495c4e2b1 100644 --- a/sdk/dotnet/Config/Config.cs +++ b/sdk/dotnet/Config/Config.cs @@ -62,11 +62,11 @@ public static Pulumi.AwsNative.Config.Types.AssumeRole? AssumeRole set => _assumeRole.Set(value); } - private static readonly __Value?> _defaultTags = new __Value?>(() => __config.GetObject>("defaultTags")); + private static readonly __Value _defaultTags = new __Value(() => __config.GetObject("defaultTags")); /// /// Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. /// - public static ImmutableDictionary? DefaultTags + public static Pulumi.AwsNative.Config.Types.DefaultTags? DefaultTags { get => _defaultTags.Get(); set => _defaultTags.Set(value); @@ -281,6 +281,14 @@ public class AssumeRole public ImmutableArray TransitiveTagKeys { get; set; } } + public class DefaultTags + { + /// + /// A group of tags to set across all resources. + /// + public ImmutableDictionary? Tags { get; set; } = null!; + } + public class Endpoints { /// diff --git a/sdk/dotnet/Inputs/ProviderDefaultTagsArgs.cs b/sdk/dotnet/Inputs/ProviderDefaultTagsArgs.cs new file mode 100644 index 0000000000..658d3329db --- /dev/null +++ b/sdk/dotnet/Inputs/ProviderDefaultTagsArgs.cs @@ -0,0 +1,35 @@ +// *** WARNING: this file was generated by the Pulumi SDK Generator. *** +// *** 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; + +namespace Pulumi.AwsNative.Inputs +{ + + /// + /// The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. + /// + public sealed class ProviderDefaultTagsArgs : global::Pulumi.ResourceArgs + { + [Input("tags")] + private InputMap? _tags; + + /// + /// A group of tags to set across all resources. + /// + public InputMap Tags + { + get => _tags ?? (_tags = new InputMap()); + set => _tags = value; + } + + public ProviderDefaultTagsArgs() + { + } + public static new ProviderDefaultTagsArgs Empty => new ProviderDefaultTagsArgs(); + } +} diff --git a/sdk/dotnet/Provider.cs b/sdk/dotnet/Provider.cs index 9c0bc82d57..49095628c9 100644 --- a/sdk/dotnet/Provider.cs +++ b/sdk/dotnet/Provider.cs @@ -101,17 +101,11 @@ public InputList AllowedAccountIds [Input("assumeRole", json: true)] public Input? AssumeRole { get; set; } - [Input("defaultTags", json: true)] - private InputMap? _defaultTags; - /// /// Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. /// - public InputMap DefaultTags - { - get => _defaultTags ?? (_defaultTags = new InputMap()); - set => _defaultTags = value; - } + [Input("defaultTags", json: true)] + public Input? DefaultTags { get; set; } [Input("endpoints", json: true)] private InputList? _endpoints; diff --git a/sdk/go/aws/config/pulumiTypes.go b/sdk/go/aws/config/pulumiTypes.go index e201d4942f..19d644936a 100644 --- a/sdk/go/aws/config/pulumiTypes.go +++ b/sdk/go/aws/config/pulumiTypes.go @@ -29,6 +29,12 @@ type AssumeRole struct { TransitiveTagKeys []string `pulumi:"transitiveTagKeys"` } +// The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. +type DefaultTags struct { + // A group of tags to set across all resources. + Tags map[string]string `pulumi:"tags"` +} + // The configuration for for customizing service endpoints. type Endpoints struct { // Override the default endpoint for AWS CloudControl diff --git a/sdk/go/aws/provider.go b/sdk/go/aws/provider.go index 01e1bf9642..e2b61c7b54 100644 --- a/sdk/go/aws/provider.go +++ b/sdk/go/aws/provider.go @@ -86,7 +86,7 @@ type providerArgs struct { // Configuration for retrieving temporary credentials from the STS service. AssumeRole *ProviderAssumeRole `pulumi:"assumeRole"` // Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. - DefaultTags map[string]string `pulumi:"defaultTags"` + DefaultTags *ProviderDefaultTags `pulumi:"defaultTags"` // Configuration block for customizing service endpoints. Endpoints []ProviderEndpoint `pulumi:"endpoints"` // List of forbidden AWS account IDs to prevent you from mistakenly using the wrong one (and potentially end up destroying a live environment). Conflicts with `allowedAccountIds`. @@ -132,7 +132,7 @@ type ProviderArgs struct { // Configuration for retrieving temporary credentials from the STS service. AssumeRole ProviderAssumeRolePtrInput // Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. - DefaultTags pulumi.StringMapInput + DefaultTags ProviderDefaultTagsPtrInput // Configuration block for customizing service endpoints. Endpoints ProviderEndpointArrayInput // List of forbidden AWS account IDs to prevent you from mistakenly using the wrong one (and potentially end up destroying a live environment). Conflicts with `allowedAccountIds`. diff --git a/sdk/go/aws/pulumiTypes.go b/sdk/go/aws/pulumiTypes.go index 8b009bb164..d8a3817f98 100644 --- a/sdk/go/aws/pulumiTypes.go +++ b/sdk/go/aws/pulumiTypes.go @@ -395,6 +395,146 @@ func (o ProviderAssumeRolePtrOutput) TransitiveTagKeys() pulumi.StringArrayOutpu }).(pulumi.StringArrayOutput) } +// The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. +type ProviderDefaultTags struct { + // A group of tags to set across all resources. + Tags map[string]string `pulumi:"tags"` +} + +// ProviderDefaultTagsInput is an input type that accepts ProviderDefaultTagsArgs and ProviderDefaultTagsOutput values. +// You can construct a concrete instance of `ProviderDefaultTagsInput` via: +// +// ProviderDefaultTagsArgs{...} +type ProviderDefaultTagsInput interface { + pulumi.Input + + ToProviderDefaultTagsOutput() ProviderDefaultTagsOutput + ToProviderDefaultTagsOutputWithContext(context.Context) ProviderDefaultTagsOutput +} + +// The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. +type ProviderDefaultTagsArgs struct { + // A group of tags to set across all resources. + Tags pulumi.StringMapInput `pulumi:"tags"` +} + +func (ProviderDefaultTagsArgs) ElementType() reflect.Type { + return reflect.TypeOf((*ProviderDefaultTags)(nil)).Elem() +} + +func (i ProviderDefaultTagsArgs) ToProviderDefaultTagsOutput() ProviderDefaultTagsOutput { + return i.ToProviderDefaultTagsOutputWithContext(context.Background()) +} + +func (i ProviderDefaultTagsArgs) ToProviderDefaultTagsOutputWithContext(ctx context.Context) ProviderDefaultTagsOutput { + return pulumi.ToOutputWithContext(ctx, i).(ProviderDefaultTagsOutput) +} + +func (i ProviderDefaultTagsArgs) ToProviderDefaultTagsPtrOutput() ProviderDefaultTagsPtrOutput { + return i.ToProviderDefaultTagsPtrOutputWithContext(context.Background()) +} + +func (i ProviderDefaultTagsArgs) ToProviderDefaultTagsPtrOutputWithContext(ctx context.Context) ProviderDefaultTagsPtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(ProviderDefaultTagsOutput).ToProviderDefaultTagsPtrOutputWithContext(ctx) +} + +// ProviderDefaultTagsPtrInput is an input type that accepts ProviderDefaultTagsArgs, ProviderDefaultTagsPtr and ProviderDefaultTagsPtrOutput values. +// You can construct a concrete instance of `ProviderDefaultTagsPtrInput` via: +// +// ProviderDefaultTagsArgs{...} +// +// or: +// +// nil +type ProviderDefaultTagsPtrInput interface { + pulumi.Input + + ToProviderDefaultTagsPtrOutput() ProviderDefaultTagsPtrOutput + ToProviderDefaultTagsPtrOutputWithContext(context.Context) ProviderDefaultTagsPtrOutput +} + +type providerDefaultTagsPtrType ProviderDefaultTagsArgs + +func ProviderDefaultTagsPtr(v *ProviderDefaultTagsArgs) ProviderDefaultTagsPtrInput { + return (*providerDefaultTagsPtrType)(v) +} + +func (*providerDefaultTagsPtrType) ElementType() reflect.Type { + return reflect.TypeOf((**ProviderDefaultTags)(nil)).Elem() +} + +func (i *providerDefaultTagsPtrType) ToProviderDefaultTagsPtrOutput() ProviderDefaultTagsPtrOutput { + return i.ToProviderDefaultTagsPtrOutputWithContext(context.Background()) +} + +func (i *providerDefaultTagsPtrType) ToProviderDefaultTagsPtrOutputWithContext(ctx context.Context) ProviderDefaultTagsPtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(ProviderDefaultTagsPtrOutput) +} + +// The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. +type ProviderDefaultTagsOutput struct{ *pulumi.OutputState } + +func (ProviderDefaultTagsOutput) ElementType() reflect.Type { + return reflect.TypeOf((*ProviderDefaultTags)(nil)).Elem() +} + +func (o ProviderDefaultTagsOutput) ToProviderDefaultTagsOutput() ProviderDefaultTagsOutput { + return o +} + +func (o ProviderDefaultTagsOutput) ToProviderDefaultTagsOutputWithContext(ctx context.Context) ProviderDefaultTagsOutput { + return o +} + +func (o ProviderDefaultTagsOutput) ToProviderDefaultTagsPtrOutput() ProviderDefaultTagsPtrOutput { + return o.ToProviderDefaultTagsPtrOutputWithContext(context.Background()) +} + +func (o ProviderDefaultTagsOutput) ToProviderDefaultTagsPtrOutputWithContext(ctx context.Context) ProviderDefaultTagsPtrOutput { + return o.ApplyTWithContext(ctx, func(_ context.Context, v ProviderDefaultTags) *ProviderDefaultTags { + return &v + }).(ProviderDefaultTagsPtrOutput) +} + +// A group of tags to set across all resources. +func (o ProviderDefaultTagsOutput) Tags() pulumi.StringMapOutput { + return o.ApplyT(func(v ProviderDefaultTags) map[string]string { return v.Tags }).(pulumi.StringMapOutput) +} + +type ProviderDefaultTagsPtrOutput struct{ *pulumi.OutputState } + +func (ProviderDefaultTagsPtrOutput) ElementType() reflect.Type { + return reflect.TypeOf((**ProviderDefaultTags)(nil)).Elem() +} + +func (o ProviderDefaultTagsPtrOutput) ToProviderDefaultTagsPtrOutput() ProviderDefaultTagsPtrOutput { + return o +} + +func (o ProviderDefaultTagsPtrOutput) ToProviderDefaultTagsPtrOutputWithContext(ctx context.Context) ProviderDefaultTagsPtrOutput { + return o +} + +func (o ProviderDefaultTagsPtrOutput) Elem() ProviderDefaultTagsOutput { + return o.ApplyT(func(v *ProviderDefaultTags) ProviderDefaultTags { + if v != nil { + return *v + } + var ret ProviderDefaultTags + return ret + }).(ProviderDefaultTagsOutput) +} + +// A group of tags to set across all resources. +func (o ProviderDefaultTagsPtrOutput) Tags() pulumi.StringMapOutput { + return o.ApplyT(func(v *ProviderDefaultTags) map[string]string { + if v == nil { + return nil + } + return v.Tags + }).(pulumi.StringMapOutput) +} + // The configuration for for customizing service endpoints. type ProviderEndpoint struct { // Override the default endpoint for AWS CloudControl @@ -804,6 +944,8 @@ func init() { pulumi.RegisterInputType(reflect.TypeOf((*CreateOnlyTagArrayInput)(nil)).Elem(), CreateOnlyTagArray{}) pulumi.RegisterInputType(reflect.TypeOf((*ProviderAssumeRoleInput)(nil)).Elem(), ProviderAssumeRoleArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*ProviderAssumeRolePtrInput)(nil)).Elem(), ProviderAssumeRoleArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*ProviderDefaultTagsInput)(nil)).Elem(), ProviderDefaultTagsArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*ProviderDefaultTagsPtrInput)(nil)).Elem(), ProviderDefaultTagsArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*ProviderEndpointInput)(nil)).Elem(), ProviderEndpointArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*ProviderEndpointArrayInput)(nil)).Elem(), ProviderEndpointArray{}) pulumi.RegisterInputType(reflect.TypeOf((*ProviderIgnoreTagsInput)(nil)).Elem(), ProviderIgnoreTagsArgs{}) @@ -814,6 +956,8 @@ func init() { pulumi.RegisterOutputType(CreateOnlyTagArrayOutput{}) pulumi.RegisterOutputType(ProviderAssumeRoleOutput{}) pulumi.RegisterOutputType(ProviderAssumeRolePtrOutput{}) + pulumi.RegisterOutputType(ProviderDefaultTagsOutput{}) + pulumi.RegisterOutputType(ProviderDefaultTagsPtrOutput{}) pulumi.RegisterOutputType(ProviderEndpointOutput{}) pulumi.RegisterOutputType(ProviderEndpointArrayOutput{}) pulumi.RegisterOutputType(ProviderIgnoreTagsOutput{}) diff --git a/sdk/nodejs/config/vars.ts b/sdk/nodejs/config/vars.ts index 49e86e867a..5e04c874c1 100644 --- a/sdk/nodejs/config/vars.ts +++ b/sdk/nodejs/config/vars.ts @@ -48,10 +48,10 @@ Object.defineProperty(exports, "assumeRole", { /** * Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. */ -export declare const defaultTags: {[key: string]: string} | undefined; +export declare const defaultTags: outputs.config.DefaultTags | undefined; Object.defineProperty(exports, "defaultTags", { get() { - return __config.getObject<{[key: string]: string}>("defaultTags"); + return __config.getObject("defaultTags"); }, enumerable: true, }); diff --git a/sdk/nodejs/provider.ts b/sdk/nodejs/provider.ts index bb9074db3c..96c5eb92ef 100644 --- a/sdk/nodejs/provider.ts +++ b/sdk/nodejs/provider.ts @@ -104,7 +104,7 @@ export interface ProviderArgs { /** * Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. */ - defaultTags?: pulumi.Input<{[key: string]: pulumi.Input}>; + defaultTags?: pulumi.Input; /** * Configuration block for customizing service endpoints. */ diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index 4accd4eb3c..229ae57f8f 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -58,6 +58,16 @@ export interface ProviderAssumeRoleArgs { transitiveTagKeys?: pulumi.Input[]>; } +/** + * The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. + */ +export interface ProviderDefaultTagsArgs { + /** + * A group of tags to set across all resources. + */ + tags?: pulumi.Input<{[key: string]: pulumi.Input}>; +} + /** * The configuration for for customizing service endpoints. */ diff --git a/sdk/nodejs/types/output.ts b/sdk/nodejs/types/output.ts index ddd90e1708..eaf70f3aac 100644 --- a/sdk/nodejs/types/output.ts +++ b/sdk/nodejs/types/output.ts @@ -8665,6 +8665,16 @@ export namespace config { transitiveTagKeys?: string[]; } + /** + * The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. + */ + export interface DefaultTags { + /** + * A group of tags to set across all resources. + */ + tags?: {[key: string]: string}; + } + /** * The configuration for for customizing service endpoints. */ diff --git a/sdk/python/pulumi_aws_native/_inputs.py b/sdk/python/pulumi_aws_native/_inputs.py index 978f0c7c79..7b06cf3805 100644 --- a/sdk/python/pulumi_aws_native/_inputs.py +++ b/sdk/python/pulumi_aws_native/_inputs.py @@ -13,6 +13,7 @@ __all__ = [ 'CreateOnlyTagArgs', 'ProviderAssumeRoleArgs', + 'ProviderDefaultTagsArgs', 'ProviderEndpointArgs', 'ProviderIgnoreTagsArgs', 'TagArgs', @@ -192,6 +193,30 @@ def transitive_tag_keys(self, value: Optional[pulumi.Input[Sequence[pulumi.Input pulumi.set(self, "transitive_tag_keys", value) +@pulumi.input_type +class ProviderDefaultTagsArgs: + def __init__(__self__, *, + tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None): + """ + The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. + :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A group of tags to set across all resources. + """ + if tags is not None: + pulumi.set(__self__, "tags", tags) + + @property + @pulumi.getter + def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: + """ + A group of tags to set across all resources. + """ + return pulumi.get(self, "tags") + + @tags.setter + def tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]): + pulumi.set(self, "tags", value) + + @pulumi.input_type class ProviderEndpointArgs: def __init__(__self__, *, diff --git a/sdk/python/pulumi_aws_native/config/outputs.py b/sdk/python/pulumi_aws_native/config/outputs.py index f683ad6a37..36e03a9ef4 100644 --- a/sdk/python/pulumi_aws_native/config/outputs.py +++ b/sdk/python/pulumi_aws_native/config/outputs.py @@ -11,6 +11,7 @@ __all__ = [ 'AssumeRole', + 'DefaultTags', 'Endpoints', 'IgnoreTags', ] @@ -122,6 +123,29 @@ def transitive_tag_keys(self) -> Optional[Sequence[str]]: return pulumi.get(self, "transitive_tag_keys") +@pulumi.output_type +class DefaultTags(dict): + """ + The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. + """ + def __init__(__self__, *, + tags: Optional[Mapping[str, str]] = None): + """ + The configuration with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. + :param Mapping[str, str] tags: A group of tags to set across all resources. + """ + if tags is not None: + pulumi.set(__self__, "tags", tags) + + @property + @pulumi.getter + def tags(self) -> Optional[Mapping[str, str]]: + """ + A group of tags to set across all resources. + """ + return pulumi.get(self, "tags") + + @pulumi.output_type class Endpoints(dict): """ diff --git a/sdk/python/pulumi_aws_native/provider.py b/sdk/python/pulumi_aws_native/provider.py index f7005bd287..eb30e2ef66 100644 --- a/sdk/python/pulumi_aws_native/provider.py +++ b/sdk/python/pulumi_aws_native/provider.py @@ -19,7 +19,7 @@ def __init__(__self__, *, access_key: Optional[pulumi.Input[str]] = None, allowed_account_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, assume_role: Optional[pulumi.Input['ProviderAssumeRoleArgs']] = None, - default_tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + default_tags: Optional[pulumi.Input['ProviderDefaultTagsArgs']] = None, endpoints: Optional[pulumi.Input[Sequence[pulumi.Input['ProviderEndpointArgs']]]] = None, forbidden_account_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, ignore_tags: Optional[pulumi.Input['ProviderIgnoreTagsArgs']] = None, @@ -42,7 +42,7 @@ def __init__(__self__, *, :param pulumi.Input[str] access_key: The access key for API operations. You can retrieve this from the ‘Security & Credentials’ section of the AWS console. :param pulumi.Input[Sequence[pulumi.Input[str]]] allowed_account_ids: List of allowed AWS account IDs to prevent you from mistakenly using an incorrect one. Conflicts with `forbiddenAccountIds`. :param pulumi.Input['ProviderAssumeRoleArgs'] assume_role: Configuration for retrieving temporary credentials from the STS service. - :param pulumi.Input[Mapping[str, pulumi.Input[str]]] default_tags: Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. + :param pulumi.Input['ProviderDefaultTagsArgs'] default_tags: Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. :param pulumi.Input[Sequence[pulumi.Input['ProviderEndpointArgs']]] endpoints: Configuration block for customizing service endpoints. :param pulumi.Input[Sequence[pulumi.Input[str]]] forbidden_account_ids: List of forbidden AWS account IDs to prevent you from mistakenly using the wrong one (and potentially end up destroying a live environment). Conflicts with `allowedAccountIds`. :param pulumi.Input['ProviderIgnoreTagsArgs'] ignore_tags: Configuration block with resource tag settings to ignore across all resources handled by this provider (except any individual service tag resources such as `ec2.Tag`) for situations where external systems are managing certain resource tags. @@ -166,14 +166,14 @@ def assume_role(self, value: Optional[pulumi.Input['ProviderAssumeRoleArgs']]): @property @pulumi.getter(name="defaultTags") - def default_tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: + def default_tags(self) -> Optional[pulumi.Input['ProviderDefaultTagsArgs']]: """ Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. """ return pulumi.get(self, "default_tags") @default_tags.setter - def default_tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]): + def default_tags(self, value: Optional[pulumi.Input['ProviderDefaultTagsArgs']]): pulumi.set(self, "default_tags", value) @property @@ -377,7 +377,7 @@ def __init__(__self__, access_key: Optional[pulumi.Input[str]] = None, allowed_account_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, assume_role: Optional[pulumi.Input[pulumi.InputType['ProviderAssumeRoleArgs']]] = None, - default_tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + default_tags: Optional[pulumi.Input[pulumi.InputType['ProviderDefaultTagsArgs']]] = None, endpoints: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ProviderEndpointArgs']]]]] = None, forbidden_account_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, ignore_tags: Optional[pulumi.Input[pulumi.InputType['ProviderIgnoreTagsArgs']]] = None, @@ -404,7 +404,7 @@ def __init__(__self__, :param pulumi.Input[str] access_key: The access key for API operations. You can retrieve this from the ‘Security & Credentials’ section of the AWS console. :param pulumi.Input[Sequence[pulumi.Input[str]]] allowed_account_ids: List of allowed AWS account IDs to prevent you from mistakenly using an incorrect one. Conflicts with `forbiddenAccountIds`. :param pulumi.Input[pulumi.InputType['ProviderAssumeRoleArgs']] assume_role: Configuration for retrieving temporary credentials from the STS service. - :param pulumi.Input[Mapping[str, pulumi.Input[str]]] default_tags: Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. + :param pulumi.Input[pulumi.InputType['ProviderDefaultTagsArgs']] default_tags: Configuration block with resource tag settings to apply across all resources handled by this provider. This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ProviderEndpointArgs']]]] endpoints: Configuration block for customizing service endpoints. :param pulumi.Input[Sequence[pulumi.Input[str]]] forbidden_account_ids: List of forbidden AWS account IDs to prevent you from mistakenly using the wrong one (and potentially end up destroying a live environment). Conflicts with `allowedAccountIds`. :param pulumi.Input[pulumi.InputType['ProviderIgnoreTagsArgs']] ignore_tags: Configuration block with resource tag settings to ignore across all resources handled by this provider (except any individual service tag resources such as `ec2.Tag`) for situations where external systems are managing certain resource tags. @@ -450,7 +450,7 @@ def _internal_init(__self__, access_key: Optional[pulumi.Input[str]] = None, allowed_account_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, assume_role: Optional[pulumi.Input[pulumi.InputType['ProviderAssumeRoleArgs']]] = None, - default_tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + default_tags: Optional[pulumi.Input[pulumi.InputType['ProviderDefaultTagsArgs']]] = None, endpoints: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ProviderEndpointArgs']]]]] = None, forbidden_account_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, ignore_tags: Optional[pulumi.Input[pulumi.InputType['ProviderIgnoreTagsArgs']]] = None,