Fixed bug with final_snapshot_identifier and skip_final_snapshot and removed apply_method as an option for now and am only supporting immediate mode

This commit is contained in:
Rob Costanzo 2014-10-23 14:07:31 -07:00
parent 0e3afa6d3d
commit a14da63a39
6 changed files with 5 additions and 23 deletions

View File

@ -347,6 +347,8 @@ func resource_aws_db_instance_validation() *config.Validator {
"security_group_names.*", "security_group_names.*",
"db_subnet_group_name", "db_subnet_group_name",
"parameter_group_name", "parameter_group_name",
"skip_final_snapshot",
"final_snapshot_identifier",
}, },
} }
} }

View File

@ -40,10 +40,6 @@ func resourceAwsDbParameterGroup() *schema.Resource {
ForceNew: false, ForceNew: false,
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"apply_method": &schema.Schema{
Type: schema.TypeString,
Required: true,
},
"name": &schema.Schema{ "name": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
@ -186,9 +182,6 @@ func resourceAwsDbParameterGroupRead(d *schema.ResourceData, meta interface{}) e
return err return err
} }
// apply_method is only relevant for creates and AWS does not maintain its state.
d.Set("parameter", flattenParameters(describeParametersResp.Parameters)) d.Set("parameter", flattenParameters(describeParametersResp.Parameters))
return nil return nil

View File

@ -199,17 +199,14 @@ resource "aws_db_parameter_group" "bar" {
parameter { parameter {
name = "character_set_server" name = "character_set_server"
value = "utf8" value = "utf8"
apply_method = "immediate"
} }
parameter { parameter {
name = "character_set_client" name = "character_set_client"
value = "utf8" value = "utf8"
apply_method = "immediate"
} }
parameter{ parameter{
name = "character_set_results" name = "character_set_results"
value = "utf8" value = "utf8"
apply_method = "immediate"
} }
} }
` `
@ -222,27 +219,22 @@ resource "aws_db_parameter_group" "bar" {
parameter { parameter {
name = "character_set_server" name = "character_set_server"
value = "utf8" value = "utf8"
apply_method = "immediate"
} }
parameter { parameter {
name = "character_set_client" name = "character_set_client"
value = "utf8" value = "utf8"
apply_method = "immediate"
} }
parameter{ parameter{
name = "character_set_results" name = "character_set_results"
value = "utf8" value = "utf8"
apply_method = "immediate"
} }
parameter { parameter {
name = "collation_server" name = "collation_server"
value = "utf8_unicode_ci" value = "utf8_unicode_ci"
apply_method = "immediate"
} }
parameter { parameter {
name = "collation_connection" name = "collation_connection"
value = "utf8_unicode_ci" value = "utf8_unicode_ci"
apply_method = "immediate"
} }
} }
` `

View File

@ -99,7 +99,9 @@ func expandParameters(configured []interface{}) ([]rds.Parameter, error) {
data := pRaw.(map[string]interface{}) data := pRaw.(map[string]interface{})
p := rds.Parameter{ p := rds.Parameter{
ApplyMethod: data["apply_method"].(string), // Only immediate is supported for now; should add in pending-reboot at some point
// but gets tricky as the DescribeParameterGroups AWS call doesn't return this data
ApplyMethod: "immediate",
ParameterName: data["name"].(string), ParameterName: data["name"].(string),
ParameterValue: data["value"].(string), ParameterValue: data["value"].(string),
} }
@ -192,9 +194,6 @@ func flattenParameters(list []rds.Parameter) []map[string]interface{} {
result = append(result, map[string]interface{}{ result = append(result, map[string]interface{}{
"name": strings.ToLower(i.ParameterName), "name": strings.ToLower(i.ParameterName),
"value": strings.ToLower(i.ParameterValue), "value": strings.ToLower(i.ParameterValue),
// apply_method is only used on create/modify and is not returned when reading from AWS.
// This is a dummy value to print out as it's not used when doing the state diff for updating
"apply_method": "applied",
}) })
} }
return result return result

View File

@ -299,7 +299,6 @@ func Test_flattenParameters(t *testing.T) {
map[string]interface{}{ map[string]interface{}{
"name": "character_set_client", "name": "character_set_client",
"value": "utf8", "value": "utf8",
"apply_method": "applied",
}, },
}, },
}, },

View File

@ -19,13 +19,11 @@ resource "aws_db_parameter_group" "default" {
parameter { parameter {
name = "character_set_server" name = "character_set_server"
value = "utf8" value = "utf8"
apply_method = "immediate"
} }
parameter { parameter {
name = "character_set_client" name = "character_set_client"
value = "utf8" value = "utf8"
apply_method = "immediate"
} }
} }
``` ```
@ -43,7 +41,6 @@ Parameter blocks support the following:
* `name` - (Required) The name of the DB parameter. * `name` - (Required) The name of the DB parameter.
* `value` - (Required) The value of the DB parameter. * `value` - (Required) The value of the DB parameter.
* `apply_method` - (Required) Indicates when to apply parameter updates. Either immediate or pending-reboot.
## Attributes Reference ## Attributes Reference