Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDS: Added two CW log export values to support postgresql #6829

Merged
merged 2 commits into from
Dec 12, 2018

Conversation

tylersmith34
Copy link
Contributor

This change allows for CloudWatch log exports to be enabled for PostgreSQL databases v9.6.6 and newer. Older versions use the existing log exports but newer versions have their own list. This PR adds those new values to the list and to the documentation.

Changes proposed in this pull request:

  • Update the list in the aws_db_instance code
  • Update the list in the documentation

Note, it's in two commits because my company blocks access to GitHub so I had to use the GUI to make the changes.

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSAvailabilityZones'

...

I didn't run the acceptance tests, I don't have an account where I can incur charges and I only added two items to a list.

The new values are supported by PostgreSQL after version PostgreSQL 9.6.6.  PostgreSQL doesn't support the existing values in the log export list.
The new values are supported by PostgreSQL after version PostgreSQL 9.6.6.  PostgreSQL doesn't support the existing values in the log export list.
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/rds Issues and PRs that pertain to the rds service. documentation Introduces or discusses updates to documentation. labels Dec 12, 2018
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Dec 12, 2018
@bflad bflad added this to the v1.52.0 milestone Dec 12, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @tylersmith34! 🚀

I'm adding an acceptance test on merge just to prevent future regressions. 👍

--- PASS: TestAccAWSDBInstance_EnabledCloudwatchLogsExports_Postgresql (599.82s)
func TestAccAWSDBInstance_EnabledCloudwatchLogsExports_Postgresql(t *testing.T) {
	var dbInstance rds.DBInstance

	rName := acctest.RandomWithPrefix("tf-acc-test")
	resourceName := "aws_db_instance.test"

	resource.ParallelTest(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSDBInstanceDestroy,
		Steps: []resource.TestStep{
			{
				Config: testAccAWSDBInstanceConfig_EnabledCloudwatchLogsExports_Postgresql(rName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSDBInstanceExists(resourceName, &dbInstance),
					resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.#", "2"),
				),
			},
			{
				ResourceName:            resourceName,
				ImportState:             true,
				ImportStateVerify:       true,
				ImportStateVerifyIgnore: []string{"password"},
			},
		},
	})
}

func testAccAWSDBInstanceConfig_EnabledCloudwatchLogsExports_Postgresql(rName string) string {
	return fmt.Sprintf(`
resource "aws_db_instance" "test" {
  allocated_storage               = 10
  enabled_cloudwatch_logs_exports = ["postgresql", "upgrade"]
  engine                          = "postgres"
  identifier                      = %q
  instance_class                  = "db.t2.micro"
  password                        = "avoid-plaintext-passwords"
  username                        = "tfacctest"
  skip_final_snapshot             = true
}
`, rName)
}

@bflad bflad merged commit e58d45e into hashicorp:master Dec 12, 2018
bflad added a commit that referenced this pull request Dec 12, 2018
@tylersmith34 tylersmith34 deleted the cw_rds_l branch December 13, 2018 16:20
@tylersmith34
Copy link
Contributor Author

@bflad Do you want me to add that acceptance test and submit a PR?

@bflad
Copy link
Contributor

bflad commented Dec 13, 2018

I already added it.

@bflad
Copy link
Contributor

bflad commented Dec 13, 2018

This has been released in version 1.52.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

curtis-fugue added a commit to LuminalHQ/terraform-provider-aws that referenced this pull request Mar 13, 2019
 * hashicorp#6829

Adds "postgresql" and "upgrade" as valid options.
@guersam
Copy link

guersam commented May 22, 2019

I guess these should be allowed in aws_rds_cluster resource too. WDYT?

UPDATE
Nevermind, aurora-postgresql engine does not support exporting to CloudWatch Logs yet.

@ckuehl
Copy link

ckuehl commented Aug 7, 2019

Nevermind, aurora-postgresql engine does not support exporting to CloudWatch Logs yet.

It appears that it does now, so similar changes need to be made to aws_rds_cluster.

Specifically, just postgresql appears to be supported:

        {
            "Engine": "aurora-postgresql",
            "EngineVersion": "10.7",
            "DBParameterGroupFamily": "aurora-postgresql10",
            "DBEngineDescription": "Aurora (PostgreSQL)",
            "DBEngineVersionDescription": "Aurora PostgreSQL (compatible with PostgreSQL 10.7)",
            "ValidUpgradeTarget": [],
            "ExportableLogTypes": [
                "postgresql"
            ],
            "SupportsLogExportsToCloudwatchLogs": true,
            "SupportsReadReplica": false,
            "SupportedEngineModes": [
                "provisioned"
            ],
            "SupportedFeatureNames": [
                "s3Import"
            ]
        }

@ghost
Copy link

ghost commented Nov 2, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/rds Issues and PRs that pertain to the rds service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants