Skip to content

Commit

Permalink
Merge pull request #711 from duplocloud/release/0.10.48
Browse files Browse the repository at this point in the history
Release v0.10.48
  • Loading branch information
zafarabbas authored Sep 17, 2024
2 parents 657171f + bea26d5 commit 16033ec
Show file tree
Hide file tree
Showing 25 changed files with 784 additions and 75 deletions.
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
## 2024-09-17

### Enhanced

- Updated `duplocloud_gcp_sql_database_instance` to handle `ip_address` as a list of strings.
- Improved formatting and corrected typos in the `database_version` field description.

## 2024-09-16

### Enhanced

- Improved handling of Performance Insights configuration for RDS read replicas, particularly for Aurora clusters.
- Enhanced RDS instance and read replica schemas by adding `DiffSuppressFunc` to suppress changes when Performance Insights is disabled.

### Documentation

- Updated documentation and examples to reflect changes in Performance Insights configuration, providing clearer guidance on referencing from primary resources.

## 2024-09-13

### Enhanced

- Added `DiffSuppressFunc` to suppress diffs for `performance_insights` when disabled in RDS instance and read replica schemas.
- Modified logic to always set `performance_insights` state, regardless of enablement status.
- Implemented validation to prevent Aurora read replicas from having performance insights configurations, as these are managed at the cluster level.

### Documentation

- Updated documentation to specify that the retention period for DocumentDB is 7 days.

## 2024-09-12

### Enhanced

- Added `ForceNew` property to the `availability_zone` attribute in RDS instances to ensure replacement on change.
- Improved handling of performance insights attributes by setting them only when enabled, preventing unnecessary diffs.

## 2024-09-11

### Enhanced

- Added performance insights configuration to RDS read replica resources, allowing for improved database performance monitoring and tuning.
- Implemented logic to handle performance insights for both primary and read replica RDS instances, including waiting for insights to be enabled.
- Updated validation and update processes to support performance insights for read replicas, ensuring consistent application of settings.

## 2024-09-10

### Documentation

- Updated RDS instance documentation to clarify performance insights configuration and defaults.
- Revised examples to include DocumentDB with performance insights.

## 2024-09-10

### Enhanced

- Enabled performance insights for DocumentDB in RDS instances by updating the create and update context logic.
- Modified validation logic for RDS parameters to support DocumentDB performance insights.
- Added `ApplyImmediately` option for performance insights updates to apply changes immediately.
- Increased the delete timeout for MWAA environments to 60 minutes to accommodate longer deletion times.

## 2024-09-10

### Enhanced
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NAMESPACE=duplocloud

NAME=duplocloud
BINARY=terraform-provider-${NAME}
VERSION=0.10.47
VERSION=0.10.48
#mac
#OS_ARCH=darwin_amd64
#OS_ARCH=linux_amd64
Expand Down
6 changes: 3 additions & 3 deletions docs/resources/gcp_sql_database_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "duplocloud_gcp_sql_database_instance" "sql_instance" {

### Required

- `database_version` (String) The MySQL, PostgreSQL orSQL Server version to use.Supported values include `MYSQL_5_6`,`MYSQL_5_7`, `MYSQL_8_0`, `POSTGRES_9_6`,`POSTGRES_10`,`POSTGRES_11`,`POSTGRES_12`, `POSTGRES_13`, `POSTGRES_14`, `POSTGRES_15`, `SQLSERVER_2017_STANDARD`,`SQLSERVER_2017_ENTERPRISE`,`SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`.`SQLSERVER_2019_STANDARD`, `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`,`SQLSERVER_2019_WEB`.[Database Version Policies](https://cloud.google.com/sql/docs/db-versions)includes an up-to-date reference of supported versions.
- `database_version` (String) The MySQL, PostgreSQL or SQL Server version to use.Supported values include `MYSQL_5_6`,`MYSQL_5_7`, `MYSQL_8_0`, `POSTGRES_9_6`,`POSTGRES_10`,`POSTGRES_11`,`POSTGRES_12`, `POSTGRES_13`, `POSTGRES_14`, `POSTGRES_15`, `SQLSERVER_2017_STANDARD`,`SQLSERVER_2017_ENTERPRISE`,`SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`,`SQLSERVER_2019_STANDARD`, `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`,`SQLSERVER_2019_WEB`.[Database Version Policies](https://cloud.google.com/sql/docs/db-versions) includes an up-to-date reference of supported versions.
- `name` (String) The short name of the sql database. Duplo will add a prefix to the name. You can retrieve the full name from the `fullname` attribute.
- `tenant_id` (String) The GUID of the tenant that the sql database will be created in.
- `tier` (String) The machine type to use. See tiers for more details and supported versions. Postgres supports only shared-core machine types, and custom machine types such as `db-custom-2-13312`.See the [Custom Machine Type Documentation](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#create) to learn about specifying custom machine types.
Expand All @@ -51,10 +51,10 @@ resource "duplocloud_gcp_sql_database_instance" "sql_instance" {

### Read-Only

- `connection_name` (String) Connection name of the database.
- `connection_name` (String) Connection name of the database.
- `fullname` (String) The full name of the sql database.
- `id` (String) The ID of this resource.
- `ip_address` (String) IP address of the database.
- `ip_address` (List of String) List of IP addresses of the database.
- `self_link` (String) The SelfLink of the sql database.

<a id="nestedblock--timeouts"></a>
Expand Down
74 changes: 72 additions & 2 deletions docs/resources/rds_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,76 @@ resource "duplocloud_rds_instance" "mysql-db" {
}
```


# Example for enabling performance insights in a RDS instance

```
resource "duplocloud_rds_instance" "mydb" {
tenant_id = data.duplocloud_tenant.tenant.id
name = "mydb1psql"
engine = 1 // PostgreSQL
engine_version = "14.11"
size = "db.t3.micro"
master_username = "myuser"
master_password = "Qaazwedd#1"
encrypt_storage = true
store_details_in_secret_manager = true
enhanced_monitoring = 0
storage_type = "gp2"
performance_insights {
enabled = true
retention_period = 7
}
}
```

# Example for enabling performance insights in a RDS cluster

```
resource "duplocloud_rds_instance" "mydb" {
tenant_id = data.duplocloud_tenant.tenant.id
name = "clust"
engine = 8 // PostgreSQL
engine_version = "8.0.mysql_aurora.3.07.1"
size = "db.r5.large"
master_username = "myuser"
master_password = "Qaazwedd#1"
encrypt_storage = true
store_details_in_secret_manager = true
enhanced_monitoring = 0
performance_insights {
enabled = true
retention_period = 7
}
}
```

# Example for enabling performance insights in a Document DB
```
resource "duplocloud_rds_instance" "mydb" {
tenant_id = data.duplocloud_tenant.tenant.id
name = "doc"
engine = 13
engine_version = "3.6.0"
size = "db.t3.medium"
master_username = "myuser"
master_password = "Qaazwedd#1"
encrypt_storage = true
store_details_in_secret_manager = true
enhanced_monitoring = 0
performance_insights {
enabled = true
retention_period = 7
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

Expand Down Expand Up @@ -300,7 +370,7 @@ If you don't know the available engine versions for your RDS instance, you can u
- `master_username` (String) The master username of the RDS instance.
- `multi_az` (Boolean) Specifies if the RDS instance is multi-AZ.
- `parameter_group_name` (String) A RDS parameter group name to apply to the RDS instance.
- `performance_insights` (Block List, Max: 1) Amazon RDS Performance Insights is a database performance tuning and monitoring feature that helps you quickly assess the load on your database, and determine when and where to take action. Perfomance Insights get apply when enable is set to true. Not applicable for Cluster Db (see [below for nested schema](#nestedblock--performance_insights))
- `performance_insights` (Block List, Max: 1) Amazon RDS Performance Insights is a database performance tuning and monitoring feature that helps you quickly assess the load on your database, and determine when and where to take action. Perfomance Insights get apply when enable is set to true. (see [below for nested schema](#nestedblock--performance_insights))
- `skip_final_snapshot` (Boolean) If the final snapshot should be taken. When set to true, the final snapshot will not be taken when the resource is deleted. Defaults to `false`.
- `snapshot_id` (String) A database snapshot to initialize the RDS instance from, at launch.
- `storage_type` (String) Valid values: gp2 | gp3 | io1 | standard | aurora. Storage type to be used for RDS instance storage.
Expand All @@ -326,7 +396,7 @@ Optional:

- `enabled` (Boolean) Turn on or off Performance Insights Defaults to `false`.
- `kms_key_id` (String) Specify ARN for the KMS key to encrypt Performance Insights data.
- `retention_period` (Number) Specify retention period in Days. Valid values are 7, 731 (2 years) or a multiple of 31
- `retention_period` (Number) Specify retention period in Days. Valid values are 7, 731 (2 years) or a multiple of 31. For Document DB retention period is 7 Defaults to `7`.


<a id="nestedblock--timeouts"></a>
Expand Down
120 changes: 120 additions & 0 deletions docs/resources/rds_read_replica.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,115 @@ resource "duplocloud_rds_read_replica" "replica" {
size = "db.t2.small"
cluster_identifier = duplocloud_rds_instance.rds.cluster_identifier
}
//Performance insight example for document db read replica
resource "duplocloud_rds_instance" "rds" {
tenant_id = duplocloud_tenant.myapp.tenant_id
name = "docDb"
engine = 13
engine_version = "3.6.0"
size = "db.t3.medium"
master_username = "myuser"
master_password = "Qaazwedd#1"
encrypt_storage = true
store_details_in_secret_manager = true
enhanced_monitoring = 0
}
resource "duplocloud_rds_read_replica" "replica" {
tenant_id = duplocloud_rds_instance.rds.tenant_id
name = "read-replica"
size = "db.t3.medium"
cluster_identifier = duplocloud_rds_instance.rds.cluster_identifier
performance_insights {
enabled = true
retention_period = 7
}
}
//Performance insight example for cluster db read replica
//Performance insight for aurora cluster db is applied at cluster level
resource "duplocloud_rds_instance" "rds" {
tenant_id = duplocloud_tenant.myapp.tenant_id
name = "clust"
engine = 8
engine_version = "8.0.mysql_aurora.3.07.1"
size = "db.r5.large"
master_username = "myuser"
master_password = "Qaazwedd#1"
encrypt_storage = true
store_details_in_secret_manager = true
enhanced_monitoring = 0
performance_insights {
enabled = false
retention_period = 31
kms_key_id = "arn:aws:kms:us-west-2:182680712604:key/6b8dc967-92bf-43de-a850-ee7b945260f8"
}
}
//referencing performance insights block from writer or primary resource is must,
//to maintain tfstate to be in sync for performance insights block.
resource "duplocloud_rds_read_replica" "replica" {
tenant_id = duplocloud_rds_instance.rds.tenant_id
name = "read-replica"
size = "db.r5.large"
cluster_identifier = duplocloud_rds_instance.rds.cluster_identifier
performance_insights {
enabled = duplocloud_rds_instance.rds.performance_insights.0.enabled
retention_period = duplocloud_rds_instance.rds.performance_insights.0.retention_period
kms_key_id = duplocloud_rds_instance.rds.performance_insights.0.kms_key_id
}
}
resource "duplocloud_rds_read_replica" "replica2" {
tenant_id = duplocloud_rds_instance.rds.tenant_id
name = "read-replica2"
size = "db.r5.large"
cluster_identifier = duplocloud_rds_instance.rds.cluster_identifier
performance_insights {
enabled = duplocloud_rds_instance.rds.performance_insights.0.enabled
retention_period = duplocloud_rds_instance.rds.performance_insights.0.retention_period
kms_key_id = duplocloud_rds_instance.rds.performance_insights.0.kms_key_id
}
}
//Performance insight example for instance db read replica
resource "duplocloud_rds_instance" "mydb" {
tenant_id = duplocloud_tenant.myapp.tenant_id
name = "mydbpsql"
engine = 1 // PostgreSQL
engine_version = "14.11"
size = "db.t3.medium"
master_username = "myuser"
master_password = "Qaazwedd#1"
encrypt_storage = false
store_details_in_secret_manager = false
enhanced_monitoring = 0
storage_type = "gp2"
performance_insights {
enabled = true
retention_period = 7
}
}
resource "duplocloud_rds_read_replica" "replica" {
tenant_id = duplocloud_rds_instance.mydb.tenant_id
name = "inst-replica"
size = "db.t3.medium"
cluster_identifier = duplocloud_rds_instance.mydb.cluster_identifier
performance_insights {
enabled = true
retention_period = 7
}
}
```

<!-- schema generated by tfplugindocs -->
Expand All @@ -53,6 +162,7 @@ See AWS documentation for the [available instance types](https://aws.amazon.com/
### Optional

- `availability_zone` (String) The AZ for the RDS instance.
- `performance_insights` (Block List, Max: 1) Amazon RDS Performance Insights is a database performance tuning and monitoring feature that helps you quickly assess the load on your database, and determine when and where to take action. Perfomance Insights get apply when enable is set to true. (see [below for nested schema](#nestedblock--performance_insights))
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-Only
Expand All @@ -71,6 +181,16 @@ See AWS documentation for the [available instance types](https://aws.amazon.com/
- `port` (Number) The listening port of the RDS read replica.
- `replica_status` (String) The current status of the RDS read replica.

<a id="nestedblock--performance_insights"></a>
### Nested Schema for `performance_insights`

Optional:

- `enabled` (Boolean) Turn on or off Performance Insights Defaults to `false`.
- `kms_key_id` (String) Specify ARN for the KMS key to encrypt Performance Insights data.
- `retention_period` (Number) Specify retention period in Days. Valid values are 7, 731 (2 years) or a multiple of 31. For Document DB retention period is 7 Defaults to `7`.


<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`

Expand Down
2 changes: 1 addition & 1 deletion duplocloud/resource_duplo_aws_mwaa_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func resourceMwaaAirflow() *schema.Resource {
},
Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(60 * time.Minute),
Delete: schema.DefaultTimeout(15 * time.Minute),
Delete: schema.DefaultTimeout(60 * time.Minute),
},
Schema: duploMwaaAirflowSchema(),
}
Expand Down
17 changes: 9 additions & 8 deletions duplocloud/resource_duplo_gcp_sql_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ func gcpSqlDBInstanceSchema() map[string]*schema.Schema {
Computed: true,
},
"database_version": {
Description: "The MySQL, PostgreSQL orSQL Server version to use." +
Description: "The MySQL, PostgreSQL or SQL Server version to use." +
"Supported values include `MYSQL_5_6`,`MYSQL_5_7`, `MYSQL_8_0`, `POSTGRES_9_6`,`POSTGRES_10`," +
"`POSTGRES_11`,`POSTGRES_12`, `POSTGRES_13`, `POSTGRES_14`, `POSTGRES_15`, `SQLSERVER_2017_STANDARD`,`SQLSERVER_2017_ENTERPRISE`," +
"`SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`.`SQLSERVER_2019_STANDARD`, `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`," +
"`SQLSERVER_2019_WEB`.[Database Version Policies](https://cloud.google.com/sql/docs/db-versions)includes an up-to-date reference of supported versions.",
"`SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`,`SQLSERVER_2019_STANDARD`, `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`," +
"`SQLSERVER_2019_WEB`.[Database Version Policies](https://cloud.google.com/sql/docs/db-versions) includes an up-to-date reference of supported versions.",
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(supportedGcpSQLDBVersions(), false),
Expand Down Expand Up @@ -84,12 +84,13 @@ func gcpSqlDBInstanceSchema() map[string]*schema.Schema {
Computed: true,
},
"ip_address": {
Description: "IP address of the database.",
Type: schema.TypeString,
Description: "List of IP addresses of the database.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"connection_name": {
Description: "Connection name of the database.",
Description: "Connection name of the database.",
Type: schema.TypeString,
Computed: true,
},
Expand All @@ -99,7 +100,6 @@ func gcpSqlDBInstanceSchema() map[string]*schema.Schema {
func checkPasswordNeeded(d *schema.ResourceData) bool {

// Check the value of dependent_field

dependentFieldValue := d.Get("database_version").(string)
mp := map[string]bool{
"SQLSERVER_2017_STANDARD": true,
Expand All @@ -113,6 +113,7 @@ func checkPasswordNeeded(d *schema.ResourceData) bool {
}
return mp[dependentFieldValue]
}

func resourceGcpSqlDBInstance() *schema.Resource {
return &schema.Resource{
Description: "`duplocloud_gcp_sql_database_instance` manages a GCP SQL Database Instance in Duplo.",
Expand Down Expand Up @@ -322,7 +323,7 @@ func flattenGcpSqlDBInstance(d *schema.ResourceData, tenantID string, name strin
d.Set("tier", duplo.Tier)
d.Set("database_version", reverseGcpSQLDBVersionsMap()[duplo.DatabaseVersion])
d.Set("disk_size", duplo.DataDiskSizeGb)
d.Set("ip_address", duplo.IPAddress)
d.Set("ip_address", flattenStringList(duplo.IPAddress))
d.Set("connection_name", duplo.ConnectionName)
flattenGcpLabels(d, duplo.Labels)
}
Expand Down
Loading

0 comments on commit 16033ec

Please sign in to comment.