Skip to content

Commit

Permalink
Added CW log export value for aurora-postgresql
Browse files Browse the repository at this point in the history
  • Loading branch information
ste1nstone committed Aug 12, 2019
1 parent 208d494 commit 45de3a4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions aws/resource_aws_rds_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ func resourceAwsRDSCluster() *schema.Resource {
"error",
"general",
"slowquery",
"postgresql",
}, false),
},
},
Expand Down
23 changes: 22 additions & 1 deletion aws/resource_aws_rds_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func TestAccAWSRDSCluster_Tags(t *testing.T) {
}

func TestAccAWSRDSCluster_EnabledCloudwatchLogsExports(t *testing.T) {
var dbCluster1, dbCluster2, dbCluster3 rds.DBCluster
var dbCluster1, dbCluster2, dbCluster3, dbCluster4 rds.DBCluster
rName := acctest.RandomWithPrefix("tf-acc-test")
resourceName := "aws_rds_cluster.test"

Expand Down Expand Up @@ -459,6 +459,14 @@ func TestAccAWSRDSCluster_EnabledCloudwatchLogsExports(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.0", "error"),
),
},
{
Config: testAccAWSClusterConfigEnabledCloudwatchLogsExportsPostgres1(rName, "postgresql"),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSClusterExists(resourceName, &dbCluster4),
resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.#", "1"),
resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.0", "postgresql"),
),
},
},
})
}
Expand Down Expand Up @@ -2080,6 +2088,19 @@ resource "aws_rds_cluster" "test" {
`, rName, enabledCloudwatchLogExports1, enabledCloudwatchLogExports2)
}

func testAccAWSClusterConfigEnabledCloudwatchLogsExportsPostgres1(rName, enabledCloudwatchLogExports1 string) string {
return fmt.Sprintf(`
resource "aws_rds_cluster" "test" {
cluster_identifier = %[1]q
enabled_cloudwatch_logs_exports = [%[2]q]
engine = "aurora-postgresql"
master_username = "foo"
master_password = "mustbeeightcharaters"
skip_final_snapshot = true
}
`, rName, enabledCloudwatchLogExports1)
}

func testAccAWSClusterConfig_kmsKey(n int) string {
return fmt.Sprintf(`
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/rds_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Default: A 30-minute window selected at random from an 8-hour block of time per
* `engine_version` - (Optional) The database engine version. Updating this argument results in an outage. See the [Aurora MySQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Updates.html) and [Aurora Postgres](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Updates.html) documentation for your configured engine to determine this value. For example with Aurora MySQL 2, a potential value for this argument is `5.7.mysql_aurora.2.03.2`.
* `source_region` - (Optional) The source region for an encrypted replica DB cluster.
* `enabled_cloudwatch_logs_exports` - (Optional) List of log types to export to cloudwatch. If omitted, no logs will be exported.
The following log types are supported: `audit`, `error`, `general`, `slowquery`.
The following log types are supported: `audit`, `error`, `general`, `slowquery`, `postgresql` (PostgreSQL).
* `scaling_configuration` - (Optional) Nested attribute with scaling properties. Only valid when `engine_mode` is set to `serverless`. More details below.
* `tags` - (Optional) A mapping of tags to assign to the DB cluster.

Expand Down

0 comments on commit 45de3a4

Please sign in to comment.