Skip to content

Commit

Permalink
Merge branch 'asg-az-vpc-zone-id-conflict' of ssh://github.com/bendru…
Browse files Browse the repository at this point in the history
…cker/terraform-provider-aws into bendrucker-asg-az-vpc-zone-id-conflict
  • Loading branch information
bflad committed Jul 14, 2020
2 parents 4a9cd8e + 8e0f85f commit effd988
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 93 deletions.
11 changes: 6 additions & 5 deletions aws/resource_aws_autoscaling_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,12 @@ func resourceAwsAutoscalingGroup() *schema.Resource {
},

"vpc_zone_identifier": {
Type: schema.TypeSet,
Optional: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
Type: schema.TypeSet,
Optional: true,
Computed: true,
ConflictsWith: []string{"availability_zones"},
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},

"termination_policies": {
Expand Down
87 changes: 0 additions & 87 deletions aws/resource_aws_autoscaling_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1342,39 +1342,6 @@ func TestAccAWSAutoScalingGroup_classicVpcZoneIdentifier(t *testing.T) {
})
}

func TestAccAWSAutoScalingGroup_emptyAvailabilityZones(t *testing.T) {
var group autoscaling.Group

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSAutoScalingGroupConfig_emptyAvailabilityZones,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSAutoScalingGroupExists("aws_autoscaling_group.test", &group),
resource.TestCheckResourceAttr("aws_autoscaling_group.test", "availability_zones.#", "1"),
),
},
{
ResourceName: "aws_autoscaling_group.test",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"force_delete",
"initial_lifecycle_hook",
"name_prefix",
"tag",
"tags",
"wait_for_capacity_timeout",
"wait_for_elb_capacity",
},
},
},
})
}

func TestAccAWSAutoScalingGroup_launchTemplate(t *testing.T) {
var group autoscaling.Group

Expand Down Expand Up @@ -3462,7 +3429,6 @@ resource "aws_autoscaling_group" "test" {
availability_zones = ["us-west-2a"]
launch_configuration = "${aws_launch_configuration.test.name}"
vpc_zone_identifier = []
}
data "aws_ami" "test_ami" {
Expand All @@ -3481,59 +3447,6 @@ resource "aws_launch_configuration" "test" {
}
`

const testAccAWSAutoScalingGroupConfig_emptyAvailabilityZones = `
resource "aws_vpc" "test" {
cidr_block = "10.0.0.0/16"
tags = {
Name = "terraform-testacc-autoscaling-group-empty-azs"
}
}
data "aws_availability_zones" "available" {
# t2.micro is not supported in us-west-2d
exclude_zone_ids = ["usw2-az4"]
state = "available"
filter {
name = "opt-in-status"
values = ["opt-in-not-required"]
}
}
resource "aws_subnet" "test" {
availability_zone = "${data.aws_availability_zones.available.names[0]}"
vpc_id = "${aws_vpc.test.id}"
cidr_block = "10.0.0.0/16"
tags = {
Name = "tf-acc-autoscaling-group-empty-availability-zones"
}
}
resource "aws_autoscaling_group" "test" {
min_size = 0
max_size = 0
availability_zones = []
launch_configuration = "${aws_launch_configuration.test.name}"
vpc_zone_identifier = ["${aws_subnet.test.id}"]
}
data "aws_ami" "test_ami" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = ["amzn-ami-hvm-*-x86_64-gp2"]
}
}
resource "aws_launch_configuration" "test" {
image_id = "${data.aws_ami.test_ami.id}"
instance_type = "t2.micro"
}
`

const testAccAWSAutoScalingGroupConfig_withLaunchTemplate = `
data "aws_ami" "test_ami" {
most_recent = true
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/autoscaling_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ The following arguments are supported:
* `max_size` - (Required) The maximum size of the auto scale group.
* `min_size` - (Required) The minimum size of the auto scale group.
(See also [Waiting for Capacity](#waiting-for-capacity) below.)
* `availability_zones` - (Required only for EC2-Classic) A list of one or more availability zones for the group. This parameter should not be specified when using `vpc_zone_identifier`.
* `availability_zones` - (Required only for EC2-Classic) A list of one or more availability zones for the group. This parameter conflicts with `vpc_zone_identifier`.
* `default_cooldown` - (Optional) The amount of time, in seconds, after a scaling activity completes before another scaling activity can start.
* `launch_configuration` - (Optional) The name of the launch configuration to use.
* `launch_template` - (Optional) Nested argument with Launch template specification to use to launch instances. Defined below.
Expand Down

0 comments on commit effd988

Please sign in to comment.