-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provider/aws: Add aws_availability_zones source #6805
Conversation
conn := meta.(*AWSClient).ec2conn | ||
|
||
log.Printf("[DEBUG] Reading availability zones") | ||
d.SetId(time.Now().UTC().String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use the time as the Id? Is it just to set something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just the convention set by @apparentlymart. It's as good as anything else :-)
Looks awesome! Cannot wait to use it :) I currently use this: https://github.com/terraform-community-modules/tf_aws_availability_zones |
@jen20 so, I'm REALLY impatient and I put this through some tests :)
I got the following:
The only issue I currently see on this is on the destroy
|
In a moment of brief forgetfulness I re-implemented this as part of #6819... so if this gets merged first I'll go back and tear that out of there. @stack72 that issue you're seeing with "unknown resource type" is one that @jen20 saw first and I saw over the weekend too, on many different data sources. It seems like a bug in the core handling of data sources during destroy, but I didn't track it down yet. |
I think we've decided on a "convention" of naming the list on singleton resources such as this |
This commit adds a data source with a single list, `instance` for the schema which gets populated with the availability zones to which an account has access.
e33812c
to
1ea727e
Compare
Tested and it Just Works ™️ with multi-provider support: provider "aws" {
alias = "east1"
region = "us-east-1"
}
provider "aws" {
alias = "west2"
region = "us-west-2"
}
data "aws_availability_zones" "east" {
provider = "aws.east1"
}
data "aws_availability_zones" "west" {
provider = "aws.west2"
}
output "east" {
value = "${data.aws_availability_zones.east.instance}"
}
output "west" {
value = "${data.aws_availability_zones.west.instance}"
} COOL! 😍 LGTM |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This pull request adds a data source with a single list,
available
, in the schema. The list is populated with the availability zones to which an account has access within the region for which the AWS provider is configured. The list is sorted alphabetically so should remain in a predictable order.