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

subscription: exposing the id field #10598

merged 4 commits into from
Feb 16, 2021

Conversation

stawii
Copy link
Contributor

@stawii stawii commented Feb 15, 2021

Fixes #10093

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @stawii

Thanks for this PR.

Taking a look through this mostly LGTM - however can we rename this nested field to id rather than resource_manager_id?

Thanks!

@@ -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": {

@@ -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

@@ -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(),

@@ -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

@stawii stawii changed the title subscription: exposing the resource_manager_id field subscription: exposing the id field Feb 16, 2021
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for this @stawii

@tombuildsstuff
Copy link
Contributor

Tests pass:

Screenshot 2021-02-16 at 10 56 42

@tombuildsstuff tombuildsstuff added this to the v2.48.0 milestone Feb 16, 2021
@tombuildsstuff tombuildsstuff merged commit 47df1c4 into hashicorp:master Feb 16, 2021
tombuildsstuff added a commit that referenced this pull request Feb 16, 2021
@stawii stawii deleted the issues/10093 branch February 16, 2021 10:00
@ghost
Copy link

ghost commented Feb 18, 2021

This has been released in version 2.48.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.48.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 18, 2021

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 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for id field in azurerm_subscriptions list
2 participants