File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 3
3
data "aws_region" "current" {}
4
4
5
5
// Fetch a list of available AZs
6
- data "aws_availability_zones" "azs" {}
6
+ data "aws_availability_zones" "azs" {
7
+ state = " available"
8
+ }
7
9
8
10
// Only reference data sources which are gauranteed to exist at any time (above) in this locals{} block
9
11
locals {
Original file line number Diff line number Diff line change @@ -32,12 +32,17 @@ func ec2Client(region string) (*ec2.EC2, error) {
32
32
}
33
33
34
34
func fetchAvailabilityZones (client * ec2.EC2 , region string ) ([]string , error ) {
35
- zoneFilter := & ec2.Filter {
36
- Name : aws .String ("region-name" ),
37
- Values : []* string {aws .String (region )},
38
- }
39
35
req := & ec2.DescribeAvailabilityZonesInput {
40
- Filters : []* ec2.Filter {zoneFilter },
36
+ Filters : []* ec2.Filter {
37
+ {
38
+ Name : aws .String ("region-name" ),
39
+ Values : []* string {aws .String (region )},
40
+ },
41
+ {
42
+ Name : aws .String ("state" ),
43
+ Values : []* string {aws .String ("available" )},
44
+ },
45
+ },
41
46
}
42
47
resp , err := client .DescribeAvailabilityZones (req )
43
48
if err != nil {
You can’t perform that action at this time.
0 commit comments