make parameter group optional

This commit is contained in:
Clint Shryock 2015-05-14 11:12:07 -05:00
parent a552db0c8c
commit aad0808cc5
1 changed files with 12 additions and 8 deletions

View File

@ -43,6 +43,7 @@ func resourceAwsElasticacheCluster() *schema.Resource {
"parameter_group_name": &schema.Schema{ "parameter_group_name": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
Computed: true,
ForceNew: true, ForceNew: true,
}, },
"port": &schema.Schema{ "port": &schema.Schema{
@ -120,7 +121,6 @@ func resourceAwsElasticacheClusterCreate(d *schema.ResourceData, meta interface{
subnetGroupName := d.Get("subnet_group_name").(string) subnetGroupName := d.Get("subnet_group_name").(string)
securityNameSet := d.Get("security_group_names").(*schema.Set) securityNameSet := d.Get("security_group_names").(*schema.Set)
securityIdSet := d.Get("security_group_ids").(*schema.Set) securityIdSet := d.Get("security_group_ids").(*schema.Set)
paramGroupName := d.Get("parameter_group_name").(string) // default.memcached1.4
securityNames := expandStringList(securityNameSet.List()) securityNames := expandStringList(securityNameSet.List())
securityIds := expandStringList(securityIdSet.List()) securityIds := expandStringList(securityIdSet.List())
@ -135,7 +135,11 @@ func resourceAwsElasticacheClusterCreate(d *schema.ResourceData, meta interface{
CacheSubnetGroupName: aws.String(subnetGroupName), CacheSubnetGroupName: aws.String(subnetGroupName),
CacheSecurityGroupNames: securityNames, CacheSecurityGroupNames: securityNames,
SecurityGroupIDs: securityIds, SecurityGroupIDs: securityIds,
CacheParameterGroupName: aws.String(paramGroupName), }
// parameter groups are optional and can be defaulted by AWS
if v, ok := d.GetOk("parameter_group_name"); ok {
req.CacheParameterGroupName = aws.String(v.(string))
} }
_, err := conn.CreateCacheCluster(req) _, err := conn.CreateCacheCluster(req)