Skip to content

Commit

Permalink
Merge pull request #897 from bitglue/apply_method
Browse files Browse the repository at this point in the history
provider/aws: Implement apply_method for RDS parameters
  • Loading branch information
mitchellh committed Feb 17, 2015
2 parents 61215d8 + 8eb5418 commit f63aa41
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
13 changes: 13 additions & 0 deletions builtin/providers/aws/resource_aws_db_parameter_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ func resourceAwsDbParameterGroup() *schema.Resource {
Type: schema.TypeString,
Required: true,
},
"apply_method": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "immediate",
// this parameter is not actually state, but a
// meta-parameter describing how the RDS API call
// to modify the parameter group should be made.
// Future reads of the resource from AWS don't tell
// us what we used for apply_method previously, so
// by squashing state to an empty string we avoid
// needing to do an update for every future run.
StateFunc: func(interface{}) string { return "" },
},
},
},
Set: resourceAwsDbParameterHash,
Expand Down
4 changes: 1 addition & 3 deletions builtin/providers/aws/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ func expandParameters(configured []interface{}) ([]rds.Parameter, error) {
data := pRaw.(map[string]interface{})

p := rds.Parameter{
// 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",
ApplyMethod: data["apply_method"].(string),
ParameterName: data["name"].(string),
ParameterValue: data["value"].(string),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ Parameter blocks support the following:

* `name` - (Required) The name of the DB parameter.
* `value` - (Required) The value of the DB parameter.
* `apply_method` - (Optional) "immediate" (default), or "pending-reboot". Some
engines can't apply some parameters without a reboot, and you will need to
specify "pending-reboot" here.

## Attributes Reference

Expand Down

0 comments on commit f63aa41

Please sign in to comment.