Merge pull request #2160 from grubernaut/elasticache_port_required

provider/aws: Set AWS Elasticache Port Number to be required
This commit is contained in:
Mitchell Hashimoto 2015-06-07 22:27:59 -07:00
commit 8748a86e60
3 changed files with 7 additions and 6 deletions

View File

@ -52,8 +52,7 @@ func resourceAwsElasticacheCluster() *schema.Resource {
}, },
"port": &schema.Schema{ "port": &schema.Schema{
Type: schema.TypeInt, Type: schema.TypeInt,
Default: 11211, Required: true,
Optional: true,
ForceNew: true, ForceNew: true,
}, },
"engine_version": &schema.Schema{ "engine_version": &schema.Schema{
@ -123,7 +122,7 @@ func resourceAwsElasticacheClusterCreate(d *schema.ResourceData, meta interface{
numNodes := int64(d.Get("num_cache_nodes").(int)) // 2 numNodes := int64(d.Get("num_cache_nodes").(int)) // 2
engine := d.Get("engine").(string) // memcached engine := d.Get("engine").(string) // memcached
engineVersion := d.Get("engine_version").(string) // 1.4.14 engineVersion := d.Get("engine_version").(string) // 1.4.14
port := int64(d.Get("port").(int)) // 11211 port := int64(d.Get("port").(int)) // e.g) 11211
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)

View File

@ -96,7 +96,7 @@ func genRandInt() int {
} }
var testAccAWSElasticacheClusterConfig = fmt.Sprintf(` var testAccAWSElasticacheClusterConfig = fmt.Sprintf(`
provider "aws" { provider "aws" {
region = "us-east-1" region = "us-east-1"
} }
resource "aws_security_group" "bar" { resource "aws_security_group" "bar" {
@ -121,6 +121,7 @@ resource "aws_elasticache_cluster" "bar" {
engine = "memcached" engine = "memcached"
node_type = "cache.m1.small" node_type = "cache.m1.small"
num_cache_nodes = 1 num_cache_nodes = 1
port = 11211
parameter_group_name = "default.memcached1.4" parameter_group_name = "default.memcached1.4"
security_group_names = ["${aws_elasticache_security_group.bar.name}"] security_group_names = ["${aws_elasticache_security_group.bar.name}"]
} }

View File

@ -17,6 +17,7 @@ resource "aws_elasticache_cluster" "bar" {
cluster_id = "cluster-example" cluster_id = "cluster-example"
engine = "memcached" engine = "memcached"
node_type = "cache.m1.small" node_type = "cache.m1.small"
port = 11211
num_cache_nodes = 1 num_cache_nodes = 1
parameter_group_name = "default.memcached1.4" parameter_group_name = "default.memcached1.4"
} }
@ -47,8 +48,8 @@ value must be between 1 and 20
* `parameter_group_name` (Required) Name of the parameter group to associate * `parameter_group_name` (Required) Name of the parameter group to associate
with this cache cluster with this cache cluster
* `port` (Optional) The port number on which each of the cache nodes will * `port` (Required) The port number on which each of the cache nodes will
accept connections. Default 11211. accept connections. For Memcache the default is 11211, and for Redis the default port is 6379.
* `subnet_group_name` (Optional, VPC only) Name of the subnet group to be used * `subnet_group_name` (Optional, VPC only) Name of the subnet group to be used
for the cache cluster. for the cache cluster.