From a3d5eecabc96c5847ada093d780cf392c8236590 Mon Sep 17 00:00:00 2001 From: Prom3theu5 Date: Sun, 12 Jun 2022 04:25:17 +0100 Subject: [PATCH] change secrets to just password --- .../pulumi-resource-onepassword/schema.json | 32 ++--- provider/resources.go | 12 -- sdk/dotnet/Item.cs | 116 +++--------------- sdk/go/onepassword/item.go | 16 --- sdk/nodejs/item.ts | 10 +- .../simcubeltd_pulumi_onepassword/item.py | 10 +- 6 files changed, 36 insertions(+), 160 deletions(-) diff --git a/provider/cmd/pulumi-resource-onepassword/schema.json b/provider/cmd/pulumi-resource-onepassword/schema.json index ea69ecb..7bfe514 100644 --- a/provider/cmd/pulumi-resource-onepassword/schema.json +++ b/provider/cmd/pulumi-resource-onepassword/schema.json @@ -372,8 +372,7 @@ }, "hostname": { "type": "string", - "description": "(Only applies to the database category) The address where the database can be found\n", - "secret": true + "description": "(Only applies to the database category) The address where the database can be found\n" }, "password": { "type": "string", @@ -386,8 +385,7 @@ }, "port": { "type": "string", - "description": "(Only applies to the database category) The port the database is listening on.\n", - "secret": true + "description": "(Only applies to the database category) The port the database is listening on.\n" }, "sections": { "type": "array", @@ -417,8 +415,7 @@ }, "username": { "type": "string", - "description": "Username for this item.\n", - "secret": true + "description": "Username for this item.\n" }, "uuid": { "type": "string", @@ -426,8 +423,7 @@ }, "vault": { "type": "string", - "description": "The UUID of the vault the item is in.\n", - "secret": true + "description": "The UUID of the vault the item is in.\n" } }, "required": [ @@ -447,8 +443,7 @@ }, "hostname": { "type": "string", - "description": "(Only applies to the database category) The address where the database can be found\n", - "secret": true + "description": "(Only applies to the database category) The address where the database can be found\n" }, "password": { "type": "string", @@ -461,8 +456,7 @@ }, "port": { "type": "string", - "description": "(Only applies to the database category) The port the database is listening on.\n", - "secret": true + "description": "(Only applies to the database category) The port the database is listening on.\n" }, "sections": { "type": "array", @@ -492,13 +486,11 @@ }, "username": { "type": "string", - "description": "Username for this item.\n", - "secret": true + "description": "Username for this item.\n" }, "vault": { "type": "string", "description": "The UUID of the vault the item is in.\n", - "secret": true, "willReplaceOnChanges": true } }, @@ -519,8 +511,7 @@ }, "hostname": { "type": "string", - "description": "(Only applies to the database category) The address where the database can be found\n", - "secret": true + "description": "(Only applies to the database category) The address where the database can be found\n" }, "password": { "type": "string", @@ -533,8 +524,7 @@ }, "port": { "type": "string", - "description": "(Only applies to the database category) The port the database is listening on.\n", - "secret": true + "description": "(Only applies to the database category) The port the database is listening on.\n" }, "sections": { "type": "array", @@ -564,8 +554,7 @@ }, "username": { "type": "string", - "description": "Username for this item.\n", - "secret": true + "description": "Username for this item.\n" }, "uuid": { "type": "string", @@ -574,7 +563,6 @@ "vault": { "type": "string", "description": "The UUID of the vault the item is in.\n", - "secret": true, "willReplaceOnChanges": true } }, diff --git a/provider/resources.go b/provider/resources.go index 63e042f..70a4dcf 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -53,18 +53,6 @@ func Provider() tfbridge.ProviderInfo { "password": { Secret: tfbridge.True(), }, - "username": { - Secret: tfbridge.True(), - }, - "vault": { - Secret: tfbridge.True(), - }, - "hostname": { - Secret: tfbridge.True(), - }, - "port": { - Secret: tfbridge.True(), - }, }, }, }, diff --git a/sdk/dotnet/Item.cs b/sdk/dotnet/Item.cs index fc53164..b9968b6 100644 --- a/sdk/dotnet/Item.cs +++ b/sdk/dotnet/Item.cs @@ -177,11 +177,7 @@ private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? PluginDownloadURL = "https://github.com/SimCubeLtd/pulumi-onepassword/releases/download/v${VERSION}", AdditionalSecretOutputs = { - "hostname", "password", - "port", - "username", - "vault", }, }; var merged = CustomResourceOptions.Merge(defaultOptions, options); @@ -218,21 +214,11 @@ public sealed class ItemArgs : Pulumi.ResourceArgs [Input("database")] public Input? Database { get; set; } - [Input("hostname")] - private Input? _hostname; - /// /// (Only applies to the database category) The address where the database can be found /// - public Input? Hostname - { - get => _hostname; - set - { - var emptySecret = Output.CreateSecret(0); - _hostname = Output.Tuple?, int>(value, emptySecret).Apply(t => t.Item1); - } - } + [Input("hostname")] + public Input? Hostname { get; set; } [Input("password")] private Input? _password; @@ -256,21 +242,11 @@ public Input? Password [Input("passwordRecipe")] public Input? PasswordRecipe { get; set; } - [Input("port")] - private Input? _port; - /// /// (Only applies to the database category) The port the database is listening on. /// - public Input? Port - { - get => _port; - set - { - var emptySecret = Output.CreateSecret(0); - _port = Output.Tuple?, int>(value, emptySecret).Apply(t => t.Item1); - } - } + [Input("port")] + public Input? Port { get; set; } [Input("sections")] private InputList? _sections; @@ -314,37 +290,17 @@ public InputList Tags [Input("url")] public Input? Url { get; set; } - [Input("username")] - private Input? _username; - /// /// Username for this item. /// - public Input? Username - { - get => _username; - set - { - var emptySecret = Output.CreateSecret(0); - _username = Output.Tuple?, int>(value, emptySecret).Apply(t => t.Item1); - } - } - - [Input("vault", required: true)] - private Input? _vault; + [Input("username")] + public Input? Username { get; set; } /// /// The UUID of the vault the item is in. /// - public Input? Vault - { - get => _vault; - set - { - var emptySecret = Output.CreateSecret(0); - _vault = Output.Tuple?, int>(value, emptySecret).Apply(t => t.Item1); - } - } + [Input("vault", required: true)] + public Input Vault { get; set; } = null!; public ItemArgs() { @@ -365,21 +321,11 @@ public sealed class ItemState : Pulumi.ResourceArgs [Input("database")] public Input? Database { get; set; } - [Input("hostname")] - private Input? _hostname; - /// /// (Only applies to the database category) The address where the database can be found /// - public Input? Hostname - { - get => _hostname; - set - { - var emptySecret = Output.CreateSecret(0); - _hostname = Output.Tuple?, int>(value, emptySecret).Apply(t => t.Item1); - } - } + [Input("hostname")] + public Input? Hostname { get; set; } [Input("password")] private Input? _password; @@ -403,21 +349,11 @@ public Input? Password [Input("passwordRecipe")] public Input? PasswordRecipe { get; set; } - [Input("port")] - private Input? _port; - /// /// (Only applies to the database category) The port the database is listening on. /// - public Input? Port - { - get => _port; - set - { - var emptySecret = Output.CreateSecret(0); - _port = Output.Tuple?, int>(value, emptySecret).Apply(t => t.Item1); - } - } + [Input("port")] + public Input? Port { get; set; } [Input("sections")] private InputList? _sections; @@ -461,21 +397,11 @@ public InputList Tags [Input("url")] public Input? Url { get; set; } - [Input("username")] - private Input? _username; - /// /// Username for this item. /// - public Input? Username - { - get => _username; - set - { - var emptySecret = Output.CreateSecret(0); - _username = Output.Tuple?, int>(value, emptySecret).Apply(t => t.Item1); - } - } + [Input("username")] + public Input? Username { get; set; } /// /// The UUID of the item. Item identifiers are unique within a specific vault. @@ -483,21 +409,11 @@ public Input? Username [Input("uuid")] public Input? Uuid { get; set; } - [Input("vault")] - private Input? _vault; - /// /// The UUID of the vault the item is in. /// - public Input? Vault - { - get => _vault; - set - { - var emptySecret = Output.CreateSecret(0); - _vault = Output.Tuple?, int>(value, emptySecret).Apply(t => t.Item1); - } - } + [Input("vault")] + public Input? Vault { get; set; } public ItemState() { diff --git a/sdk/go/onepassword/item.go b/sdk/go/onepassword/item.go index 1398eec..1eff01d 100644 --- a/sdk/go/onepassword/item.go +++ b/sdk/go/onepassword/item.go @@ -115,27 +115,11 @@ func NewItem(ctx *pulumi.Context, if args.Vault == nil { return nil, errors.New("invalid value for required argument 'Vault'") } - if args.Hostname != nil { - args.Hostname = pulumi.ToSecret(args.Hostname).(pulumi.StringPtrOutput) - } if args.Password != nil { args.Password = pulumi.ToSecret(args.Password).(pulumi.StringPtrOutput) } - if args.Port != nil { - args.Port = pulumi.ToSecret(args.Port).(pulumi.StringPtrOutput) - } - if args.Username != nil { - args.Username = pulumi.ToSecret(args.Username).(pulumi.StringPtrOutput) - } - if args.Vault != nil { - args.Vault = pulumi.ToSecret(args.Vault).(pulumi.StringOutput) - } secrets := pulumi.AdditionalSecretOutputs([]string{ - "hostname", "password", - "port", - "username", - "vault", }) opts = append(opts, secrets) opts = pkgResourceDefaultOpts(opts) diff --git a/sdk/nodejs/item.ts b/sdk/nodejs/item.ts index a9eb31f..0273e5c 100644 --- a/sdk/nodejs/item.ts +++ b/sdk/nodejs/item.ts @@ -168,21 +168,21 @@ export class Item extends pulumi.CustomResource { } resourceInputs["category"] = args ? args.category : undefined; resourceInputs["database"] = args ? args.database : undefined; - resourceInputs["hostname"] = args?.hostname ? pulumi.secret(args.hostname) : undefined; + resourceInputs["hostname"] = args ? args.hostname : undefined; resourceInputs["password"] = args?.password ? pulumi.secret(args.password) : undefined; resourceInputs["passwordRecipe"] = args ? args.passwordRecipe : undefined; - resourceInputs["port"] = args?.port ? pulumi.secret(args.port) : undefined; + resourceInputs["port"] = args ? args.port : undefined; resourceInputs["sections"] = args ? args.sections : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["title"] = args ? args.title : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["url"] = args ? args.url : undefined; - resourceInputs["username"] = args?.username ? pulumi.secret(args.username) : undefined; - resourceInputs["vault"] = args?.vault ? pulumi.secret(args.vault) : undefined; + resourceInputs["username"] = args ? args.username : undefined; + resourceInputs["vault"] = args ? args.vault : undefined; resourceInputs["uuid"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); - const secretOpts = { additionalSecretOutputs: ["hostname", "password", "port", "username", "vault"] }; + const secretOpts = { additionalSecretOutputs: ["password"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Item.__pulumiType, name, resourceInputs, opts); } diff --git a/sdk/python/simcubeltd_pulumi_onepassword/item.py b/sdk/python/simcubeltd_pulumi_onepassword/item.py index 8d02e1c..8868725 100644 --- a/sdk/python/simcubeltd_pulumi_onepassword/item.py +++ b/sdk/python/simcubeltd_pulumi_onepassword/item.py @@ -626,21 +626,21 @@ def _internal_init(__self__, __props__.__dict__["category"] = category __props__.__dict__["database"] = database - __props__.__dict__["hostname"] = None if hostname is None else pulumi.Output.secret(hostname) + __props__.__dict__["hostname"] = hostname __props__.__dict__["password"] = None if password is None else pulumi.Output.secret(password) __props__.__dict__["password_recipe"] = password_recipe - __props__.__dict__["port"] = None if port is None else pulumi.Output.secret(port) + __props__.__dict__["port"] = port __props__.__dict__["sections"] = sections __props__.__dict__["tags"] = tags __props__.__dict__["title"] = title __props__.__dict__["type"] = type __props__.__dict__["url"] = url - __props__.__dict__["username"] = None if username is None else pulumi.Output.secret(username) + __props__.__dict__["username"] = username if vault is None and not opts.urn: raise TypeError("Missing required property 'vault'") - __props__.__dict__["vault"] = None if vault is None else pulumi.Output.secret(vault) + __props__.__dict__["vault"] = vault __props__.__dict__["uuid"] = None - secret_opts = pulumi.ResourceOptions(additional_secret_outputs=["hostname", "password", "port", "username", "vault"]) + secret_opts = pulumi.ResourceOptions(additional_secret_outputs=["password"]) opts = pulumi.ResourceOptions.merge(opts, secret_opts) super(Item, __self__).__init__( 'onepassword:index/item:Item',