Skip to content

Commit

Permalink
Merge branch 'main' into dbaas-scalable-storage-read-replicas
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinshenker authored Jan 17, 2024
2 parents 8e97870 + 5865783 commit f9d9e03
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 2.34.1

BUG FIXES:

- `digitalocean_cdn`: handle 'needs-cloudflare-cert' case in read func (#1095). - @andrewsomething
- `digitalocean_database_cluster`: ignore seconds in maintenance_window.hour (#1094). - @andrewsomething
- build(deps): bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#1096). - @dependabot[bot]

# 2.34.0

IMPROVEMENTS:
Expand Down
17 changes: 17 additions & 0 deletions digitalocean/database/datasource_database_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ func DataSourceDigitalOceanDatabaseUser() *schema.Resource {
Computed: true,
Sensitive: true,
},
"access_cert": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"access_key": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"mysql_auth_plugin": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -75,6 +85,13 @@ func dataSourceDigitalOceanDatabaseUserRead(ctx context.Context, d *schema.Resou
d.Set("mysql_auth_plugin", user.MySQLSettings.AuthPlugin)
}

if user.AccessCert != "" {
d.Set("access_cert", user.AccessCert)
}
if user.AccessKey != "" {
d.Set("access_key", user.AccessKey)
}

if err := d.Set("settings", flattenUserSettings(user.Settings)); err != nil {
return diag.Errorf("Error setting user settings: %#v", err)
}
Expand Down
8 changes: 8 additions & 0 deletions digitalocean/database/datasource_database_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func TestAccDataSourceDigitalOceanDatabaseUser_Basic(t *testing.T) {
"digitalocean_database_user.foobar_user", "role"),
resource.TestCheckResourceAttrSet(
"digitalocean_database_user.foobar_user", "password"),
resource.TestCheckNoResourceAttr(
"digitalocean_database_user.foobar_user", "access_cert"),
resource.TestCheckNoResourceAttr(
"digitalocean_database_user.foobar_user", "access_key"),
),
},
{
Expand All @@ -45,6 +49,10 @@ func TestAccDataSourceDigitalOceanDatabaseUser_Basic(t *testing.T) {
"data.digitalocean_database_user.foobar_user", "role"),
resource.TestCheckResourceAttrPair("digitalocean_database_user.foobar_user", "password",
"data.digitalocean_database_user.foobar_user", "password"),
resource.TestCheckNoResourceAttr(
"digitalocean_database_user.foobar_user", "access_cert"),
resource.TestCheckNoResourceAttr(
"digitalocean_database_user.foobar_user", "access_key"),
),
},
},
Expand Down
18 changes: 18 additions & 0 deletions digitalocean/database/resource_database_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ func ResourceDigitalOceanDatabaseUser() *schema.Resource {
Computed: true,
Sensitive: true,
},
"access_cert": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"access_key": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
},
}
}
Expand Down Expand Up @@ -186,6 +196,14 @@ func setDatabaseUserAttributes(d *schema.ResourceData, user *godo.DatabaseUser)
if user.MySQLSettings != nil {
d.Set("mysql_auth_plugin", user.MySQLSettings.AuthPlugin)
}

// This is only set for kafka users
if user.AccessCert != "" {
d.Set("access_cert", user.AccessCert)
}
if user.AccessKey != "" {
d.Set("access_key", user.AccessKey)
}
}

func resourceDigitalOceanDatabaseUserUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
Expand Down
14 changes: 14 additions & 0 deletions digitalocean/database/resource_database_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ func TestAccDigitalOceanDatabaseUser_Basic(t *testing.T) {
"digitalocean_database_user.foobar_user", "role"),
resource.TestCheckResourceAttrSet(
"digitalocean_database_user.foobar_user", "password"),
resource.TestCheckNoResourceAttr(
"digitalocean_database_user.foobar_user", "mysql_auth_plugin"),
resource.TestCheckNoResourceAttr(
"digitalocean_database_user.foobar_user", "access_cert"),
resource.TestCheckNoResourceAttr(
"digitalocean_database_user.foobar_user", "access_key"),
),
},
{
Expand Down Expand Up @@ -197,6 +203,10 @@ func TestAccDigitalOceanDatabaseUser_KafkaACLs(t *testing.T) {
"digitalocean_database_user.foobar_user", "role"),
resource.TestCheckResourceAttrSet(
"digitalocean_database_user.foobar_user", "password"),
resource.TestCheckResourceAttrSet(
"digitalocean_database_user.foobar_user", "access_cert"),
resource.TestCheckResourceAttrSet(
"digitalocean_database_user.foobar_user", "access_key"),
resource.TestCheckResourceAttrSet(
"digitalocean_database_user.foobar_user", "settings.0.acl.0.id"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -234,6 +244,10 @@ func TestAccDigitalOceanDatabaseUser_KafkaACLs(t *testing.T) {
"digitalocean_database_user.foobar_user", "role"),
resource.TestCheckResourceAttrSet(
"digitalocean_database_user.foobar_user", "password"),
resource.TestCheckResourceAttrSet(
"digitalocean_database_user.foobar_user", "access_cert"),
resource.TestCheckResourceAttrSet(
"digitalocean_database_user.foobar_user", "access_key"),
resource.TestCheckResourceAttrSet(
"digitalocean_database_user.foobar_user", "settings.0.acl.0.id"),
resource.TestCheckResourceAttr(
Expand Down
2 changes: 1 addition & 1 deletion digitalocean/uptime/resource_uptime_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func ResourceDigitalOceanUptimeAlert() *schema.Resource {
"10m",
"15m",
"30m",
"1hr",
"1h",
}, false),
Optional: true,
},
Expand Down
2 changes: 2 additions & 0 deletions docs/data-sources/database_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ The following attributes are exported:

* `role` - The role of the database user. The value will be either `primary` or `normal`.
* `password` - The password of the database user. This will not be set for MongoDB users.
* `access_cert` - Access certificate for TLS client authentication. (Kafka only)
* `access_key` - Access key for TLS client authentication. (Kafka only)
* `mysql_auth_plugin` - The authentication method of the MySQL user. The value will be `mysql_native_password` or `caching_sha2_password`.
2 changes: 2 additions & 0 deletions docs/resources/database_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ In addition to the above arguments, the following attributes are exported:

* `role` - Role for the database user. The value will be either "primary" or "normal".
* `password` - Password for the database user.
* `access_cert` - Access certificate for TLS client authentication. (Kafka only)
* `access_key` - Access key for TLS client authentication. (Kafka only)

For individual ACLs for Kafka topics, the following attributes are exported:
* `id` - An identifier for the ACL, this will be automatically assigned when you create an ACL entry
Expand Down

0 comments on commit f9d9e03

Please sign in to comment.