Skip to content

Commit 3bf7b73

Browse files
authored
Mark some fields as secret (#790)
Fixes #773.
1 parent 1c07006 commit 3bf7b73

File tree

4 files changed

+87
-21
lines changed

4 files changed

+87
-21
lines changed

provider/cmd/pulumi-resource-command/schema.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@
8888
},
8989
"password": {
9090
"type": "string",
91-
"description": "The password we should use for the connection."
91+
"description": "The password we should use for the connection.",
92+
"secret": true
9293
},
9394
"perDialTimeout": {
9495
"type": "integer",
@@ -102,11 +103,13 @@
102103
},
103104
"privateKey": {
104105
"type": "string",
105-
"description": "The contents of an SSH key to use for the connection. This takes preference over the password if provided."
106+
"description": "The contents of an SSH key to use for the connection. This takes preference over the password if provided.",
107+
"secret": true
106108
},
107109
"privateKeyPassword": {
108110
"type": "string",
109-
"description": "The password to use in case the private key is encrypted."
111+
"description": "The password to use in case the private key is encrypted.",
112+
"secret": true
110113
},
111114
"proxy": {
112115
"$ref": "#/types/command:remote:ProxyConnection",
@@ -162,7 +165,8 @@
162165
},
163166
"password": {
164167
"type": "string",
165-
"description": "The password we should use for the connection to the bastion host."
168+
"description": "The password we should use for the connection to the bastion host.",
169+
"secret": true
166170
},
167171
"perDialTimeout": {
168172
"type": "integer",
@@ -176,11 +180,13 @@
176180
},
177181
"privateKey": {
178182
"type": "string",
179-
"description": "The contents of an SSH key to use for the connection. This takes preference over the password if provided."
183+
"description": "The contents of an SSH key to use for the connection. This takes preference over the password if provided.",
184+
"secret": true
180185
},
181186
"privateKeyPassword": {
182187
"type": "string",
183-
"description": "The password to use in case the private key is encrypted."
188+
"description": "The password to use in case the private key is encrypted.",
189+
"secret": true
184190
},
185191
"user": {
186192
"type": "string",

provider/pkg/provider/remote/connection.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ type Connection struct {
4444

4545
type connectionBase struct {
4646
User *string `pulumi:"user,optional"`
47-
Password *string `pulumi:"password,optional"`
47+
Password *string `pulumi:"password,optional" provider:"secret"`
4848
Host *string `pulumi:"host"`
4949
Port *float64 `pulumi:"port,optional"`
50-
PrivateKey *string `pulumi:"privateKey,optional"`
51-
PrivateKeyPassword *string `pulumi:"privateKeyPassword,optional"`
50+
PrivateKey *string `pulumi:"privateKey,optional" provider:"secret"`
51+
PrivateKeyPassword *string `pulumi:"privateKeyPassword,optional" provider:"secret"`
5252
AgentSocketPath *string `pulumi:"agentSocketPath,optional"`
5353
DialErrorLimit *int `pulumi:"dialErrorLimit,optional"`
5454
PerDialTimeout *int `pulumi:"perDialTimeout,optional"`

sdk/dotnet/Remote/Inputs/ConnectionArgs.cs

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,21 @@ public sealed class ConnectionArgs : global::Pulumi.ResourceArgs
3333
[Input("host", required: true)]
3434
public Input<string> Host { get; set; } = null!;
3535

36+
[Input("password")]
37+
private Input<string>? _password;
38+
3639
/// <summary>
3740
/// The password we should use for the connection.
3841
/// </summary>
39-
[Input("password")]
40-
public Input<string>? Password { get; set; }
42+
public Input<string>? Password
43+
{
44+
get => _password;
45+
set
46+
{
47+
var emptySecret = Output.CreateSecret(0);
48+
_password = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
49+
}
50+
}
4151

4252
/// <summary>
4353
/// Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
@@ -51,17 +61,37 @@ public sealed class ConnectionArgs : global::Pulumi.ResourceArgs
5161
[Input("port")]
5262
public Input<double>? Port { get; set; }
5363

64+
[Input("privateKey")]
65+
private Input<string>? _privateKey;
66+
5467
/// <summary>
5568
/// The contents of an SSH key to use for the connection. This takes preference over the password if provided.
5669
/// </summary>
57-
[Input("privateKey")]
58-
public Input<string>? PrivateKey { get; set; }
70+
public Input<string>? PrivateKey
71+
{
72+
get => _privateKey;
73+
set
74+
{
75+
var emptySecret = Output.CreateSecret(0);
76+
_privateKey = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
77+
}
78+
}
79+
80+
[Input("privateKeyPassword")]
81+
private Input<string>? _privateKeyPassword;
5982

6083
/// <summary>
6184
/// The password to use in case the private key is encrypted.
6285
/// </summary>
63-
[Input("privateKeyPassword")]
64-
public Input<string>? PrivateKeyPassword { get; set; }
86+
public Input<string>? PrivateKeyPassword
87+
{
88+
get => _privateKeyPassword;
89+
set
90+
{
91+
var emptySecret = Output.CreateSecret(0);
92+
_privateKeyPassword = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
93+
}
94+
}
6595

6696
/// <summary>
6797
/// The connection settings for the bastion/proxy host.

sdk/dotnet/Remote/Inputs/ProxyConnectionArgs.cs

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,21 @@ public sealed class ProxyConnectionArgs : global::Pulumi.ResourceArgs
3333
[Input("host", required: true)]
3434
public Input<string> Host { get; set; } = null!;
3535

36+
[Input("password")]
37+
private Input<string>? _password;
38+
3639
/// <summary>
3740
/// The password we should use for the connection to the bastion host.
3841
/// </summary>
39-
[Input("password")]
40-
public Input<string>? Password { get; set; }
42+
public Input<string>? Password
43+
{
44+
get => _password;
45+
set
46+
{
47+
var emptySecret = Output.CreateSecret(0);
48+
_password = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
49+
}
50+
}
4151

4252
/// <summary>
4353
/// Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
@@ -51,17 +61,37 @@ public sealed class ProxyConnectionArgs : global::Pulumi.ResourceArgs
5161
[Input("port")]
5262
public Input<double>? Port { get; set; }
5363

64+
[Input("privateKey")]
65+
private Input<string>? _privateKey;
66+
5467
/// <summary>
5568
/// The contents of an SSH key to use for the connection. This takes preference over the password if provided.
5669
/// </summary>
57-
[Input("privateKey")]
58-
public Input<string>? PrivateKey { get; set; }
70+
public Input<string>? PrivateKey
71+
{
72+
get => _privateKey;
73+
set
74+
{
75+
var emptySecret = Output.CreateSecret(0);
76+
_privateKey = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
77+
}
78+
}
79+
80+
[Input("privateKeyPassword")]
81+
private Input<string>? _privateKeyPassword;
5982

6083
/// <summary>
6184
/// The password to use in case the private key is encrypted.
6285
/// </summary>
63-
[Input("privateKeyPassword")]
64-
public Input<string>? PrivateKeyPassword { get; set; }
86+
public Input<string>? PrivateKeyPassword
87+
{
88+
get => _privateKeyPassword;
89+
set
90+
{
91+
var emptySecret = Output.CreateSecret(0);
92+
_privateKeyPassword = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
93+
}
94+
}
6595

6696
/// <summary>
6797
/// The user that we should use for the connection to the bastion host.

0 commit comments

Comments
 (0)