From f15b74b4a4e22800be8cf3471455bca652cbf64f Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Mon, 3 Apr 2017 09:56:25 +1000 Subject: [PATCH] Fix DB parameter group name property It appears that #13232 doesn't work properly if you actually try to set any `parameter`s. Specifically, I was getting the following error: ``` * aws_db_parameter_group.test: 1 error(s) occurred: * aws_db_parameter_group.test: Error modifying DB Parameter Group: InvalidParameterValue: The parameter DBParameterGroupName must be provided and must not be blank. status code: 400, request id: 5783e396-17ff-11e7-87d5-e3fd4c7025ce ``` --- .../providers/aws/resource_aws_db_parameter_group.go | 1 + .../aws/resource_aws_db_parameter_group_test.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/builtin/providers/aws/resource_aws_db_parameter_group.go b/builtin/providers/aws/resource_aws_db_parameter_group.go index d5e943fd6..4e2611ff7 100644 --- a/builtin/providers/aws/resource_aws_db_parameter_group.go +++ b/builtin/providers/aws/resource_aws_db_parameter_group.go @@ -98,6 +98,7 @@ func resourceAwsDbParameterGroupCreate(d *schema.ResourceData, meta interface{}) } else { groupName = resource.UniqueId() } + d.Set("name", groupName) createOpts := rds.CreateDBParameterGroupInput{ DBParameterGroupName: aws.String(groupName), diff --git a/builtin/providers/aws/resource_aws_db_parameter_group_test.go b/builtin/providers/aws/resource_aws_db_parameter_group_test.go index b8e4e56c4..1d330bfc7 100644 --- a/builtin/providers/aws/resource_aws_db_parameter_group_test.go +++ b/builtin/providers/aws/resource_aws_db_parameter_group_test.go @@ -715,11 +715,21 @@ const testAccDBParameterGroupConfig_namePrefix = ` resource "aws_db_parameter_group" "test" { name_prefix = "tf-test-" family = "mysql5.6" + + parameter { + name = "sync_binlog" + value = 0 + } } ` const testAccDBParameterGroupConfig_generatedName = ` resource "aws_db_parameter_group" "test" { family = "mysql5.6" + + parameter { + name = "sync_binlog" + value = 0 + } } `