From b236cdf918e31146c536b03df2c8d6446a4efa7f Mon Sep 17 00:00:00 2001 From: Jake Champlin Date: Sun, 31 May 2015 18:01:07 -0400 Subject: [PATCH] Set AWS Elasticache Port Number to be required Set Elasticache Port number to not be set by default, and require Elasticache Port number to be specified. Also updated acceptance tests to supply port number upon resource declaration Fixes #2084 --- builtin/providers/aws/resource_aws_elasticache_cluster.go | 5 ++--- .../providers/aws/resource_aws_elasticache_cluster_test.go | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/providers/aws/resource_aws_elasticache_cluster.go b/builtin/providers/aws/resource_aws_elasticache_cluster.go index 1095a9307..c8f5e5518 100644 --- a/builtin/providers/aws/resource_aws_elasticache_cluster.go +++ b/builtin/providers/aws/resource_aws_elasticache_cluster.go @@ -52,8 +52,7 @@ func resourceAwsElasticacheCluster() *schema.Resource { }, "port": &schema.Schema{ Type: schema.TypeInt, - Default: 11211, - Optional: true, + Required: true, ForceNew: true, }, "engine_version": &schema.Schema{ @@ -123,7 +122,7 @@ func resourceAwsElasticacheClusterCreate(d *schema.ResourceData, meta interface{ numNodes := int64(d.Get("num_cache_nodes").(int)) // 2 engine := d.Get("engine").(string) // memcached 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) securityNameSet := d.Get("security_group_names").(*schema.Set) securityIdSet := d.Get("security_group_ids").(*schema.Set) diff --git a/builtin/providers/aws/resource_aws_elasticache_cluster_test.go b/builtin/providers/aws/resource_aws_elasticache_cluster_test.go index 1fb478b26..3257d9ac7 100644 --- a/builtin/providers/aws/resource_aws_elasticache_cluster_test.go +++ b/builtin/providers/aws/resource_aws_elasticache_cluster_test.go @@ -95,7 +95,7 @@ func genRandInt() int { } var testAccAWSElasticacheClusterConfig = fmt.Sprintf(` -provider "aws" { +provider "aws" { region = "us-east-1" } resource "aws_security_group" "bar" { @@ -120,6 +120,7 @@ resource "aws_elasticache_cluster" "bar" { engine = "memcached" node_type = "cache.m1.small" num_cache_nodes = 1 + port = 11211 parameter_group_name = "default.memcached1.4" security_group_names = ["${aws_elasticache_security_group.bar.name}"] }