Added AWS Redshift Enhanced VPC Routing

This commit is contained in:
Anshul Sharma 2016-11-08 17:36:29 +05:30
parent 2c2c02ab62
commit 1030cc1344
2 changed files with 53 additions and 0 deletions

View File

@ -159,6 +159,12 @@ func resourceAwsRedshiftCluster() *schema.Resource {
Computed: true,
},
"enhanced_vpc_routing": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
"kms_key_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
@ -302,6 +308,10 @@ func resourceAwsRedshiftClusterCreate(d *schema.ResourceData, meta interface{})
restoreOpts.ElasticIp = aws.String(v.(string))
}
if v, ok := d.GetOk("enhanced_vpc_routing"); ok {
restoreOpts.EnhancedVpcRouting = aws.Bool(v.(bool))
}
if v, ok := d.GetOk("iam_roles"); ok {
restoreOpts.IamRoles = expandStringList(v.(*schema.Set).List())
}
@ -366,6 +376,10 @@ func resourceAwsRedshiftClusterCreate(d *schema.ResourceData, meta interface{})
createOpts.Encrypted = aws.Bool(v.(bool))
}
if v, ok := d.GetOk("enhanced_vpc_routing"); ok {
createOpts.EnhancedVpcRouting = aws.Bool(v.(bool))
}
if v, ok := d.GetOk("kms_key_id"); ok {
createOpts.KmsKeyId = aws.String(v.(string))
}

View File

@ -38,6 +38,31 @@ func TestAccAWSRedshiftCluster_basic(t *testing.T) {
})
}
func TestAccAWSRedshiftCluster_enhancedVpcRoutingEnabled(t *testing.T) {
var v redshift.Cluster
ri := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
config := fmt.Sprintf(testAccAWSRedshiftClusterConfig_enhancedVpcRoutingEnabled, ri)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: config,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSRedshiftClusterExists("aws_redshift_cluster.default", &v),
resource.TestCheckResourceAttr(
"aws_redshift_cluster.default", "cluster_type", "single-node"),
resource.TestCheckResourceAttr(
"aws_redshift_cluster.default", "enhanced_vpc_routing", "true"),
),
},
},
})
}
func TestAccAWSRedshiftCluster_loggingEnabled(t *testing.T) {
var v redshift.Cluster
@ -470,6 +495,20 @@ resource "aws_redshift_cluster" "default" {
allow_version_upgrade = false
}`
var testAccAWSRedshiftClusterConfig_enhancedVpcRoutingEnabled = `
resource "aws_redshift_cluster" "default" {
cluster_identifier = "tf-redshift-cluster-%d"
availability_zone = "us-west-2a"
database_name = "mydb"
master_username = "foo_test"
master_password = "Mustbe8characters"
node_type = "dc1.large"
automated_snapshot_retention_period = 0
allow_version_upgrade = false
enhanced_vpc_routing = true
}
`
var testAccAWSRedshiftClusterConfig_loggingDisabled = `
resource "aws_redshift_cluster" "default" {
cluster_identifier = "tf-redshift-cluster-%d"