Skip to content
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

subscription: exposing the id field #10598

Merged
merged 4 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func dataSourceSubscriptions() *schema.Resource {
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"resource_manager_id": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this just id to match other resources:

Suggested change
"resource_manager_id": {
"id": {

Type: schema.TypeString,
Computed: true,
},

"subscription_id": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -99,6 +104,9 @@ func dataSourceSubscriptionsRead(d *schema.ResourceData, meta interface{}) error

s := make(map[string]interface{})

if v := val.ID; v != nil {
s["resource_manager_id"] = *v
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this just id to match other resources:

Suggested change
s["resource_manager_id"] = *v
s["id"] = *v

}
if v := val.SubscriptionID; v != nil {
s["subscription_id"] = *v
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func TestAccDataSourceSubscriptions_basic(t *testing.T) {
{
Config: SubscriptionsDataSource{}.basic(),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("subscriptions.0.resource_manager_id").Exists(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this just id to match other resources:

Suggested change
check.That(data.ResourceName).Key("subscriptions.0.resource_manager_id").Exists(),
check.That(data.ResourceName).Key("subscriptions.0.id").Exists(),

check.That(data.ResourceName).Key("subscriptions.0.subscription_id").Exists(),
check.That(data.ResourceName).Key("subscriptions.0.display_name").Exists(),
check.That(data.ResourceName).Key("subscriptions.0.tenant_id").Exists(),
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/subscriptions.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ output "first_available_subscription_display_name" {

The `subscription` block contains:

* `resource_manager_id` - The Resource Manager ID of this subscription.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this just id to match other resources:

Suggested change
* `resource_manager_id` - The Resource Manager ID of this subscription.
* `id` - The ID of this Subscription.

Copy link
Contributor Author

@stawii stawii Feb 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a bit confused if I should use id or resource_manager_id ;) id fits "better" and it compatible with azurerm_subscription, but I've seen resource_manager_id in a lot of different places too. Seems I've picked wrong.
I'll change it soon.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no worries - we use resource_manager_id only where a secondary is present (e.g. data plane id) - otherwise this should be id

* `subscription_id` - The subscription GUID.
* `display_name` - The subscription display name.
* `tenant_id` - The subscription tenant ID.
Expand Down