-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
New data source: azurerm_subscriptions #940
Conversation
1a8ebc7
to
87229fb
Compare
87229fb
to
3633361
Compare
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.
a few minor points - otherwise LGTM assuming the tests pass 👍
"spending_limit": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, |
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.
do you think it's also worth exposing the TenantID here?
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.
The tenant will always be what the provider is using and accessible from client_config
data source.
azurerm/data_source_subscriptions.go
Outdated
if policies := val.SubscriptionPolicies; policies != nil { | ||
s["location_placement_id"] = *policies.LocationPlacementID | ||
s["quota_id"] = *policies.QuotaID | ||
s["spending_limit"] = policies.SpendingLimit |
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.
we should add nil checks around these, otherwise there's a potential crash
## Example Usage | ||
|
||
```hcl | ||
data "azurerm_subscriptions" "availible" {} |
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.
minor availible
-> available
```hcl | ||
data "azurerm_subscriptions" "availible" {} | ||
|
||
output "availible_subscriptions" { |
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.
(same here)
value = "${data.azurerm_subscriptions.current.subscriptions}" | ||
} | ||
|
||
output "first_availible_subscription_display_name" { |
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.
(same here)
return map[string]*schema.Schema{ | ||
"subscription_id": { | ||
Type: schema.TypeString, | ||
Optional: true, |
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.
Given this is only optional for the Subscription
Data Source - I believe we don't want this set for the Subscriptions
Data Source? We can override the schema for the Subscription data source to add this, there's examples in the AWS Provider
…cks and corrected schema
@@ -4,11 +4,11 @@ import ( | |||
"github.com/hashicorp/terraform/helper/schema" | |||
) | |||
|
|||
func SubscriptionSchema() map[string]*schema.Schema { | |||
return map[string]*schema.Schema{ | |||
func SubscriptionSchema(subscriptionIdOptional bool) map[string]*schema.Schema { |
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.
super minor, but use ID
(see https://github.com/golang/go/wiki/CodeReviewComments#initialisms)
Updated with requested changes. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
No description provided.