Merge pull request #11580 from hashicorp/b-fix-panic-data-azs
provider/aws: Fix panic from AZs Data Source Test
This commit is contained in:
commit
039701fa51
|
@ -16,12 +16,12 @@ func dataSourceAwsAvailabilityZones() *schema.Resource {
|
||||||
Read: dataSourceAwsAvailabilityZonesRead,
|
Read: dataSourceAwsAvailabilityZonesRead,
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"names": &schema.Schema{
|
"names": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Schema{Type: schema.TypeString},
|
Elem: &schema.Schema{Type: schema.TypeString},
|
||||||
},
|
},
|
||||||
"state": &schema.Schema{
|
"state": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ValidateFunc: validateStateType,
|
ValidateFunc: validateStateType,
|
||||||
|
@ -40,7 +40,7 @@ func dataSourceAwsAvailabilityZonesRead(d *schema.ResourceData, meta interface{}
|
||||||
|
|
||||||
if v, ok := d.GetOk("state"); ok {
|
if v, ok := d.GetOk("state"); ok {
|
||||||
request.Filters = []*ec2.Filter{
|
request.Filters = []*ec2.Filter{
|
||||||
&ec2.Filter{
|
{
|
||||||
Name: aws.String("state"),
|
Name: aws.String("state"),
|
||||||
Values: []*string{aws.String(v.(string))},
|
Values: []*string{aws.String(v.(string))},
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,13 +16,22 @@ func TestAccAWSAvailabilityZones_basic(t *testing.T) {
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
{
|
||||||
Config: testAccCheckAwsAvailabilityZonesConfig,
|
Config: testAccCheckAwsAvailabilityZonesConfig,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckAwsAvailabilityZonesMeta("data.aws_availability_zones.availability_zones"),
|
testAccCheckAwsAvailabilityZonesMeta("data.aws_availability_zones.availability_zones"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
resource.TestStep{
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestAccAWSAvailabilityZones_stateFilter(t *testing.T) {
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
{
|
||||||
Config: testAccCheckAwsAvailabilityZonesStateConfig,
|
Config: testAccCheckAwsAvailabilityZonesStateConfig,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckAwsAvailabilityZoneState("data.aws_availability_zones.state_filter"),
|
testAccCheckAwsAvailabilityZoneState("data.aws_availability_zones.state_filter"),
|
||||||
|
|
Loading…
Reference in New Issue