mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
fixing issue where changing only the description only didn't actually update on AWS
This commit is contained in:
parent
7d7da4b6b6
commit
dac69b7919
@ -103,7 +103,7 @@ func resourceAwsRedshiftSubnetGroupRead(d *schema.ResourceData, meta interface{}
|
|||||||
|
|
||||||
func resourceAwsRedshiftSubnetGroupUpdate(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsRedshiftSubnetGroupUpdate(d *schema.ResourceData, meta interface{}) error {
|
||||||
conn := meta.(*AWSClient).redshiftconn
|
conn := meta.(*AWSClient).redshiftconn
|
||||||
if d.HasChange("subnet_ids") {
|
if d.HasChange("subnet_ids") || d.HasChange("description") {
|
||||||
_, n := d.GetChange("subnet_ids")
|
_, n := d.GetChange("subnet_ids")
|
||||||
if n == nil {
|
if n == nil {
|
||||||
n = new(schema.Set)
|
n = new(schema.Set)
|
||||||
@ -117,6 +117,7 @@ func resourceAwsRedshiftSubnetGroupUpdate(d *schema.ResourceData, meta interface
|
|||||||
|
|
||||||
_, err := conn.ModifyClusterSubnetGroup(&redshift.ModifyClusterSubnetGroupInput{
|
_, err := conn.ModifyClusterSubnetGroup(&redshift.ModifyClusterSubnetGroupInput{
|
||||||
ClusterSubnetGroupName: aws.String(d.Id()),
|
ClusterSubnetGroupName: aws.String(d.Id()),
|
||||||
|
Description: aws.String(d.Get("description").(string)),
|
||||||
SubnetIds: sIds,
|
SubnetIds: sIds,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -33,6 +33,35 @@ func TestAccAWSRedshiftSubnetGroup_basic(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAccAWSRedshiftSubnetGroup_updateDescription(t *testing.T) {
|
||||||
|
var v redshift.ClusterSubnetGroup
|
||||||
|
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckRedshiftSubnetGroupDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccRedshiftSubnetGroupConfig,
|
||||||
|
Check: resource.ComposeTestCheckFunc(
|
||||||
|
testAccCheckRedshiftSubnetGroupExists("aws_redshift_subnet_group.foo", &v),
|
||||||
|
resource.TestCheckResourceAttr(
|
||||||
|
"aws_redshift_subnet_group.foo", "description", "foo description"),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccRedshiftSubnetGroup_updateDescription,
|
||||||
|
Check: resource.ComposeTestCheckFunc(
|
||||||
|
testAccCheckRedshiftSubnetGroupExists("aws_redshift_subnet_group.foo", &v),
|
||||||
|
resource.TestCheckResourceAttr(
|
||||||
|
"aws_redshift_subnet_group.foo", "description", "foo description updated"),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestAccAWSRedshiftSubnetGroup_updateSubnetIds(t *testing.T) {
|
func TestAccAWSRedshiftSubnetGroup_updateSubnetIds(t *testing.T) {
|
||||||
var v redshift.ClusterSubnetGroup
|
var v redshift.ClusterSubnetGroup
|
||||||
|
|
||||||
@ -177,6 +206,37 @@ resource "aws_subnet" "bar" {
|
|||||||
|
|
||||||
resource "aws_redshift_subnet_group" "foo" {
|
resource "aws_redshift_subnet_group" "foo" {
|
||||||
name = "foo"
|
name = "foo"
|
||||||
|
description = "foo description"
|
||||||
|
subnet_ids = ["${aws_subnet.foo.id}", "${aws_subnet.bar.id}"]
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const testAccRedshiftSubnetGroup_updateDescription = `
|
||||||
|
resource "aws_vpc" "foo" {
|
||||||
|
cidr_block = "10.1.0.0/16"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_subnet" "foo" {
|
||||||
|
cidr_block = "10.1.1.0/24"
|
||||||
|
availability_zone = "us-west-2a"
|
||||||
|
vpc_id = "${aws_vpc.foo.id}"
|
||||||
|
tags {
|
||||||
|
Name = "tf-dbsubnet-test-1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_subnet" "bar" {
|
||||||
|
cidr_block = "10.1.2.0/24"
|
||||||
|
availability_zone = "us-west-2b"
|
||||||
|
vpc_id = "${aws_vpc.foo.id}"
|
||||||
|
tags {
|
||||||
|
Name = "tf-dbsubnet-test-2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_redshift_subnet_group" "foo" {
|
||||||
|
name = "foo"
|
||||||
|
description = "foo description updated"
|
||||||
subnet_ids = ["${aws_subnet.foo.id}", "${aws_subnet.bar.id}"]
|
subnet_ids = ["${aws_subnet.foo.id}", "${aws_subnet.bar.id}"]
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
Loading…
Reference in New Issue
Block a user