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,
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"names": &schema.Schema{
|
||||
"names": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
},
|
||||
"state": &schema.Schema{
|
||||
"state": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ValidateFunc: validateStateType,
|
||||
|
@ -40,7 +40,7 @@ func dataSourceAwsAvailabilityZonesRead(d *schema.ResourceData, meta interface{}
|
|||
|
||||
if v, ok := d.GetOk("state"); ok {
|
||||
request.Filters = []*ec2.Filter{
|
||||
&ec2.Filter{
|
||||
{
|
||||
Name: aws.String("state"),
|
||||
Values: []*string{aws.String(v.(string))},
|
||||
},
|
||||
|
|
|
@ -16,13 +16,22 @@ func TestAccAWSAvailabilityZones_basic(t *testing.T) {
|
|||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
{
|
||||
Config: testAccCheckAwsAvailabilityZonesConfig,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
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,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckAwsAvailabilityZoneState("data.aws_availability_zones.state_filter"),
|
||||
|
|
Loading…
Reference in New Issue