Skip to content

Commit 8dfd628

Browse files
authored
Upgrade terraform-provider-postgresql to v1.15.0 (#152)
1 parent 5c55919 commit 8dfd628

33 files changed

+816
-262
lines changed

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

Lines changed: 49 additions & 24 deletions
Large diffs are not rendered by default.

provider/go.mod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ go 1.16
44

55
require (
66
github.com/cyrilgdn/terraform-provider-postgresql v0.0.0
7-
github.com/hashicorp/terraform-plugin-sdk v1.7.0
87
github.com/pulumi/pulumi-terraform-bridge/v3 v3.20.0
9-
github.com/pulumi/pulumi/sdk/v3 v3.27.0
8+
github.com/pulumi/pulumi/sdk/v3 v3.28.0
109
)
1110

12-
replace github.com/cyrilgdn/terraform-provider-postgresql => github.com/pulumi/terraform-provider-postgresql v1.12.1-0.20210901153353-a48f7e688aca
11+
replace (
12+
github.com/cyrilgdn/terraform-provider-postgresql => github.com/pulumi/terraform-provider-postgresql v1.12.1-0.20220405212505-5e79e19618e4
13+
github.com/hashicorp/terraform-plugin-sdk/v2 => github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20211230170131-3a7c83bfab87
14+
)

provider/go.sum

Lines changed: 38 additions & 23 deletions
Large diffs are not rendered by default.

provider/resources.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ import (
2020
"unicode"
2121

2222
"github.com/cyrilgdn/terraform-provider-postgresql/postgresql"
23-
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
2423
"github.com/pulumi/pulumi-postgresql/provider/v3/pkg/version"
2524
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
2625
shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
27-
shimv1 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v1"
26+
shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2"
2827
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
2928
"github.com/pulumi/pulumi/sdk/v3/go/common/tokens"
3029
)
@@ -65,7 +64,7 @@ func preConfigureCallback(vars resource.PropertyMap, c shim.ResourceConfig) erro
6564

6665
// Provider returns additional overlaid schema and metadata associated with the provider..
6766
func Provider() tfbridge.ProviderInfo {
68-
p := shimv1.NewProvider(postgresql.Provider().(*schema.Provider))
67+
p := shimv2.NewProvider(postgresql.Provider())
6968

7069
prov := tfbridge.ProviderInfo{
7170
P: p,
@@ -142,7 +141,11 @@ func Provider() tfbridge.ProviderInfo {
142141
}
143142

144143
prov.RenameResourceWithAlias("postgresql_default_privileges", makeResource(mainMod, "DefaultPrivileg"),
145-
makeResource(mainMod, "DefaultPrivileges"), mainMod, mainMod, nil)
144+
makeResource(mainMod, "DefaultPrivileges"), mainMod, mainMod, &tfbridge.ResourceInfo{
145+
Docs: &tfbridge.DocInfo{
146+
Source: "postgresql_default_privileges.html.markdown",
147+
},
148+
})
146149

147150
prov.SetAutonaming(255, "-")
148151

sdk/dotnet/Config/Config.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,27 @@ public void Set(T value)
3232

3333
private static readonly Pulumi.Config __config = new Pulumi.Config("postgresql");
3434

35+
private static readonly __Value<bool?> _awsRdsIamAuth = new __Value<bool?>(() => __config.GetBoolean("awsRdsIamAuth"));
36+
/// <summary>
37+
/// Use rds_iam instead of password authentication (see:
38+
/// https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html)
39+
/// </summary>
40+
public static bool? AwsRdsIamAuth
41+
{
42+
get => _awsRdsIamAuth.Get();
43+
set => _awsRdsIamAuth.Set(value);
44+
}
45+
46+
private static readonly __Value<string?> _awsRdsIamProfile = new __Value<string?>(() => __config.Get("awsRdsIamProfile"));
47+
/// <summary>
48+
/// AWS profile to use for IAM auth
49+
/// </summary>
50+
public static string? AwsRdsIamProfile
51+
{
52+
get => _awsRdsIamProfile.Get();
53+
set => _awsRdsIamProfile.Set(value);
54+
}
55+
3556
private static readonly __Value<Pulumi.PostgreSql.Config.Types.Clientcert?> _clientcert = new __Value<Pulumi.PostgreSql.Config.Types.Clientcert?>(() => __config.GetObject<Pulumi.PostgreSql.Config.Types.Clientcert>("clientcert"));
3657
/// <summary>
3758
/// SSL client certificate if required by the database.

sdk/dotnet/DefaultPrivileg.cs

Lines changed: 75 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,99 @@
99

1010
namespace Pulumi.PostgreSql
1111
{
12+
/// <summary>
13+
/// The ``postgresql.DefaultPrivileges`` resource creates and manages default privileges given to a user for a database schema.
14+
///
15+
/// &gt; **Note:** This resource needs Postgresql version 9 or above.
16+
///
17+
/// ## Usage
18+
///
19+
/// ```csharp
20+
/// using Pulumi;
21+
/// using PostgreSql = Pulumi.PostgreSql;
22+
///
23+
/// class MyStack : Stack
24+
/// {
25+
/// public MyStack()
26+
/// {
27+
/// var readOnlyTables = new PostgreSql.DefaultPrivileges("readOnlyTables", new PostgreSql.DefaultPrivilegesArgs
28+
/// {
29+
/// Database = "test_db",
30+
/// ObjectType = "table",
31+
/// Owner = "db_owner",
32+
/// Privileges =
33+
/// {
34+
/// "SELECT",
35+
/// },
36+
/// Role = "test_role",
37+
/// Schema = "public",
38+
/// });
39+
/// }
40+
///
41+
/// }
42+
/// ```
43+
///
44+
/// ## Examples
45+
///
46+
/// Revoke default privileges for functions for "public" role:
47+
///
48+
/// ```csharp
49+
/// using Pulumi;
50+
/// using PostgreSql = Pulumi.PostgreSql;
51+
///
52+
/// class MyStack : Stack
53+
/// {
54+
/// public MyStack()
55+
/// {
56+
/// var revokePublic = new PostgreSql.DefaultPrivileges("revokePublic", new PostgreSql.DefaultPrivilegesArgs
57+
/// {
58+
/// Database = postgresql_database.Example_db.Name,
59+
/// Role = "public",
60+
/// Owner = "object_owner",
61+
/// ObjectType = "function",
62+
/// Privileges = {},
63+
/// });
64+
/// }
65+
///
66+
/// }
67+
/// ```
68+
/// </summary>
1269
[Obsolete(@"postgresql.DefaultPrivileg has been deprecated in favor of postgresql.DefaultPrivileges")]
1370
[PostgreSqlResourceType("postgresql:index/defaultPrivileg:DefaultPrivileg")]
1471
public partial class DefaultPrivileg : Pulumi.CustomResource
1572
{
1673
/// <summary>
17-
/// The database to grant default privileges for this role
74+
/// The database to grant default privileges for this role.
1875
/// </summary>
1976
[Output("database")]
2077
public Output<string> Database { get; private set; } = null!;
2178

2279
/// <summary>
23-
/// The PostgreSQL object type to set the default privileges on (one of: table, sequence, function, type)
80+
/// The PostgreSQL object type to set the default privileges on (one of: table, sequence, function, type).
2481
/// </summary>
2582
[Output("objectType")]
2683
public Output<string> ObjectType { get; private set; } = null!;
2784

2885
/// <summary>
29-
/// Target role for which to alter default privileges.
86+
/// Role for which apply default privileges (You can change default privileges only for objects that will be created by yourself or by roles that you are a member of).
3087
/// </summary>
3188
[Output("owner")]
3289
public Output<string> Owner { get; private set; } = null!;
3390

3491
/// <summary>
35-
/// The list of privileges to apply as default privileges
92+
/// The list of privileges to apply as default privileges. An empty list could be provided to revoke all default privileges for this role.
3693
/// </summary>
3794
[Output("privileges")]
3895
public Output<ImmutableArray<string>> Privileges { get; private set; } = null!;
3996

4097
/// <summary>
41-
/// The name of the role to which grant default privileges on
98+
/// The name of the role to which grant default privileges on.
4299
/// </summary>
43100
[Output("role")]
44101
public Output<string> Role { get; private set; } = null!;
45102

46103
/// <summary>
47-
/// The database schema to set default privileges for this role
104+
/// The database schema to set default privileges for this role.
48105
/// </summary>
49106
[Output("schema")]
50107
public Output<string?> Schema { get; private set; } = null!;
@@ -102,19 +159,19 @@ public static DefaultPrivileg Get(string name, Input<string> id, DefaultPrivileg
102159
public sealed class DefaultPrivilegArgs : Pulumi.ResourceArgs
103160
{
104161
/// <summary>
105-
/// The database to grant default privileges for this role
162+
/// The database to grant default privileges for this role.
106163
/// </summary>
107164
[Input("database", required: true)]
108165
public Input<string> Database { get; set; } = null!;
109166

110167
/// <summary>
111-
/// The PostgreSQL object type to set the default privileges on (one of: table, sequence, function, type)
168+
/// The PostgreSQL object type to set the default privileges on (one of: table, sequence, function, type).
112169
/// </summary>
113170
[Input("objectType", required: true)]
114171
public Input<string> ObjectType { get; set; } = null!;
115172

116173
/// <summary>
117-
/// Target role for which to alter default privileges.
174+
/// Role for which apply default privileges (You can change default privileges only for objects that will be created by yourself or by roles that you are a member of).
118175
/// </summary>
119176
[Input("owner", required: true)]
120177
public Input<string> Owner { get; set; } = null!;
@@ -123,7 +180,7 @@ public sealed class DefaultPrivilegArgs : Pulumi.ResourceArgs
123180
private InputList<string>? _privileges;
124181

125182
/// <summary>
126-
/// The list of privileges to apply as default privileges
183+
/// The list of privileges to apply as default privileges. An empty list could be provided to revoke all default privileges for this role.
127184
/// </summary>
128185
public InputList<string> Privileges
129186
{
@@ -132,13 +189,13 @@ public InputList<string> Privileges
132189
}
133190

134191
/// <summary>
135-
/// The name of the role to which grant default privileges on
192+
/// The name of the role to which grant default privileges on.
136193
/// </summary>
137194
[Input("role", required: true)]
138195
public Input<string> Role { get; set; } = null!;
139196

140197
/// <summary>
141-
/// The database schema to set default privileges for this role
198+
/// The database schema to set default privileges for this role.
142199
/// </summary>
143200
[Input("schema")]
144201
public Input<string>? Schema { get; set; }
@@ -157,19 +214,19 @@ public DefaultPrivilegArgs()
157214
public sealed class DefaultPrivilegState : Pulumi.ResourceArgs
158215
{
159216
/// <summary>
160-
/// The database to grant default privileges for this role
217+
/// The database to grant default privileges for this role.
161218
/// </summary>
162219
[Input("database")]
163220
public Input<string>? Database { get; set; }
164221

165222
/// <summary>
166-
/// The PostgreSQL object type to set the default privileges on (one of: table, sequence, function, type)
223+
/// The PostgreSQL object type to set the default privileges on (one of: table, sequence, function, type).
167224
/// </summary>
168225
[Input("objectType")]
169226
public Input<string>? ObjectType { get; set; }
170227

171228
/// <summary>
172-
/// Target role for which to alter default privileges.
229+
/// Role for which apply default privileges (You can change default privileges only for objects that will be created by yourself or by roles that you are a member of).
173230
/// </summary>
174231
[Input("owner")]
175232
public Input<string>? Owner { get; set; }
@@ -178,7 +235,7 @@ public sealed class DefaultPrivilegState : Pulumi.ResourceArgs
178235
private InputList<string>? _privileges;
179236

180237
/// <summary>
181-
/// The list of privileges to apply as default privileges
238+
/// The list of privileges to apply as default privileges. An empty list could be provided to revoke all default privileges for this role.
182239
/// </summary>
183240
public InputList<string> Privileges
184241
{
@@ -187,13 +244,13 @@ public InputList<string> Privileges
187244
}
188245

189246
/// <summary>
190-
/// The name of the role to which grant default privileges on
247+
/// The name of the role to which grant default privileges on.
191248
/// </summary>
192249
[Input("role")]
193250
public Input<string>? Role { get; set; }
194251

195252
/// <summary>
196-
/// The database schema to set default privileges for this role
253+
/// The database schema to set default privileges for this role.
197254
/// </summary>
198255
[Input("schema")]
199256
public Input<string>? Schema { get; set; }

sdk/dotnet/DefaultPrivileges.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,31 @@ namespace Pulumi.PostgreSql
4040
///
4141
/// }
4242
/// ```
43+
///
44+
/// ## Examples
45+
///
46+
/// Revoke default privileges for functions for "public" role:
47+
///
48+
/// ```csharp
49+
/// using Pulumi;
50+
/// using PostgreSql = Pulumi.PostgreSql;
51+
///
52+
/// class MyStack : Stack
53+
/// {
54+
/// public MyStack()
55+
/// {
56+
/// var revokePublic = new PostgreSql.DefaultPrivileges("revokePublic", new PostgreSql.DefaultPrivilegesArgs
57+
/// {
58+
/// Database = postgresql_database.Example_db.Name,
59+
/// Role = "public",
60+
/// Owner = "object_owner",
61+
/// ObjectType = "function",
62+
/// Privileges = {},
63+
/// });
64+
/// }
65+
///
66+
/// }
67+
/// ```
4368
/// </summary>
4469
[PostgreSqlResourceType("postgresql:index/defaultPrivileges:DefaultPrivileges")]
4570
public partial class DefaultPrivileges : Pulumi.CustomResource

sdk/dotnet/Grant.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public partial class Grant : Pulumi.CustomResource
8282
public Output<string> Database { get; private set; } = null!;
8383

8484
/// <summary>
85-
/// The PostgreSQL object type to grant the privileges on (one of: database, schema, table, sequence, function, foreign_data_wrapper, foreign_server).
85+
/// The PostgreSQL object type to grant the privileges on (one of: database, schema, table, sequence, function, procedure, routine, foreign_data_wrapper, foreign_server).
8686
/// </summary>
8787
[Output("objectType")]
8888
public Output<string> ObjectType { get; private set; } = null!;
@@ -170,7 +170,7 @@ public sealed class GrantArgs : Pulumi.ResourceArgs
170170
public Input<string> Database { get; set; } = null!;
171171

172172
/// <summary>
173-
/// The PostgreSQL object type to grant the privileges on (one of: database, schema, table, sequence, function, foreign_data_wrapper, foreign_server).
173+
/// The PostgreSQL object type to grant the privileges on (one of: database, schema, table, sequence, function, procedure, routine, foreign_data_wrapper, foreign_server).
174174
/// </summary>
175175
[Input("objectType", required: true)]
176176
public Input<string> ObjectType { get; set; } = null!;
@@ -231,7 +231,7 @@ public sealed class GrantState : Pulumi.ResourceArgs
231231
public Input<string>? Database { get; set; }
232232

233233
/// <summary>
234-
/// The PostgreSQL object type to grant the privileges on (one of: database, schema, table, sequence, function, foreign_data_wrapper, foreign_server).
234+
/// The PostgreSQL object type to grant the privileges on (one of: database, schema, table, sequence, function, procedure, routine, foreign_data_wrapper, foreign_server).
235235
/// </summary>
236236
[Input("objectType")]
237237
public Input<string>? ObjectType { get; set; }

sdk/dotnet/GrantRole.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,6 @@ namespace Pulumi.PostgreSql
1515
/// When using ``postgresql.GrantRole`` resource it is likely because the PostgreSQL role you are modifying was created outside of this provider.
1616
///
1717
/// &gt; **Note:** This resource needs PostgreSQL version 9 or above.
18-
///
19-
/// &gt; **Note:** `postgresql.GrantRole` **cannot** be used in conjunction with `postgresql.Role` or they will fight over what your role grants should be.
20-
///
21-
/// ## Usage
22-
///
23-
/// ```csharp
24-
/// using Pulumi;
25-
/// using PostgreSql = Pulumi.PostgreSql;
26-
///
27-
/// class MyStack : Stack
28-
/// {
29-
/// public MyStack()
30-
/// {
31-
/// var grantRoot = new PostgreSql.GrantRole("grantRoot", new PostgreSql.GrantRoleArgs
32-
/// {
33-
/// GrantRole = "application",
34-
/// Role = "root",
35-
/// WithAdminOption = true,
36-
/// });
37-
/// }
38-
///
39-
/// }
40-
/// ```
4118
/// </summary>
4219
[PostgreSqlResourceType("postgresql:index/grantRole:GrantRole")]
4320
public partial class GrantRole : Pulumi.CustomResource

0 commit comments

Comments
 (0)