From a9a8a667269b65848894ab72a42e926282d723ce Mon Sep 17 00:00:00 2001 From: Eddie Ramirez Date: Mon, 8 Jul 2019 23:02:28 -0700 Subject: [PATCH 1/3] update subscription version --- azurerm/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurerm/config.go b/azurerm/config.go index 047cec52dc04..0fb5de2daa45 100644 --- a/azurerm/config.go +++ b/azurerm/config.go @@ -46,10 +46,10 @@ import ( backupSvc "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2017-07-01/backup" redisSvc "github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis" relaySvc "github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions" "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks" policySvc "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/policy" "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources" + "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions" schedulerSvc "github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler" searchSvc "github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search" servicebusSvc "github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus" From c8cef0294c30e85f8b9cd0922df22326dcdfd168 Mon Sep 17 00:00:00 2001 From: Eddie Ramirez Date: Mon, 8 Jul 2019 23:14:48 -0700 Subject: [PATCH 2/3] update subscription methods, tests and documentation support `TenantID` in responses --- azurerm/data_source_subscription.go | 1 + azurerm/data_source_subscription_test.go | 2 ++ azurerm/data_source_subscriptions.go | 3 +++ azurerm/data_source_subscriptions_test.go | 1 + azurerm/helpers/azure/subscription.go | 5 +++++ website/docs/d/subscription.html.markdown | 1 + website/docs/d/subscriptions.html.markdown | 1 + 7 files changed, 14 insertions(+) diff --git a/azurerm/data_source_subscription.go b/azurerm/data_source_subscription.go index 5d0848467df8..8c1b25b891a1 100644 --- a/azurerm/data_source_subscription.go +++ b/azurerm/data_source_subscription.go @@ -37,6 +37,7 @@ func dataSourceArmSubscriptionRead(d *schema.ResourceData, meta interface{}) err d.SetId(*resp.ID) d.Set("subscription_id", resp.SubscriptionID) d.Set("display_name", resp.DisplayName) + d.Set("tenant_id", resp.TenantID) d.Set("state", resp.State) if resp.SubscriptionPolicies != nil { d.Set("location_placement_id", resp.SubscriptionPolicies.LocationPlacementID) diff --git a/azurerm/data_source_subscription_test.go b/azurerm/data_source_subscription_test.go index 138986346ba4..44c8d179002d 100644 --- a/azurerm/data_source_subscription_test.go +++ b/azurerm/data_source_subscription_test.go @@ -22,6 +22,7 @@ func TestAccDataSourceAzureRMSubscription_current(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "subscription_id"), testCheckAzureRMSubscriptionId(resourceName), resource.TestCheckResourceAttrSet(resourceName, "display_name"), + resource.TestCheckResourceAttrSet(resourceName, "tenant_id"), resource.TestCheckResourceAttr(resourceName, "state", "Enabled"), ), }, @@ -42,6 +43,7 @@ func TestAccDataSourceAzureRMSubscription_specific(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "subscription_id"), testCheckAzureRMSubscriptionId(resourceName), resource.TestCheckResourceAttrSet(resourceName, "display_name"), + resource.TestCheckResourceAttrSet(resourceName, "tenant_id"), resource.TestCheckResourceAttrSet(resourceName, "location_placement_id"), resource.TestCheckResourceAttrSet(resourceName, "quota_id"), resource.TestCheckResourceAttrSet(resourceName, "spending_limit"), diff --git a/azurerm/data_source_subscriptions.go b/azurerm/data_source_subscriptions.go index 9006b0f6eef5..29a5156bcd16 100644 --- a/azurerm/data_source_subscriptions.go +++ b/azurerm/data_source_subscriptions.go @@ -56,6 +56,9 @@ func dataSourceArmSubscriptionsRead(d *schema.ResourceData, meta interface{}) er if v := val.SubscriptionID; v != nil { s["subscription_id"] = *v } + if v := val.TenantID; v != nil { + s["tenant_id"] = *v + } if v := val.DisplayName; v != nil { s["display_name"] = *v } diff --git a/azurerm/data_source_subscriptions_test.go b/azurerm/data_source_subscriptions_test.go index 387ff9ebf4dd..899ccfe2af64 100644 --- a/azurerm/data_source_subscriptions_test.go +++ b/azurerm/data_source_subscriptions_test.go @@ -18,6 +18,7 @@ func TestAccDataSourceAzureRMSubscriptions_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "subscriptions.0.subscription_id"), resource.TestCheckResourceAttrSet(resourceName, "subscriptions.0.display_name"), + resource.TestCheckResourceAttrSet(resourceName, "subscriptions.0.tenant_id"), resource.TestCheckResourceAttrSet(resourceName, "subscriptions.0.state"), ), }, diff --git a/azurerm/helpers/azure/subscription.go b/azurerm/helpers/azure/subscription.go index 38bf5c23a46d..b4333375b824 100644 --- a/azurerm/helpers/azure/subscription.go +++ b/azurerm/helpers/azure/subscription.go @@ -12,6 +12,11 @@ func SchemaSubscription(subscriptionIDOptional bool) map[string]*schema.Schema { Computed: true, }, + "tenant_id": { + Type: schema.TypeString, + Computed: true, + }, + "display_name": { Type: schema.TypeString, Computed: true, diff --git a/website/docs/d/subscription.html.markdown b/website/docs/d/subscription.html.markdown index b36dd04e92f2..013b6cdc3442 100644 --- a/website/docs/d/subscription.html.markdown +++ b/website/docs/d/subscription.html.markdown @@ -29,6 +29,7 @@ output "current_subscription_display_name" { * `id` - The ID of the subscription. * `subscription_id` - The subscription GUID. * `display_name` - The subscription display name. +* `tenant_id` - The subscription tenant ID. * `state` - The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. * `location_placement_id` - The subscription location placement ID. * `quota_id` - The subscription quota ID. diff --git a/website/docs/d/subscriptions.html.markdown b/website/docs/d/subscriptions.html.markdown index 62cc81b177d3..f8c12b0c52f0 100644 --- a/website/docs/d/subscriptions.html.markdown +++ b/website/docs/d/subscriptions.html.markdown @@ -37,6 +37,7 @@ The `subscription` block contains: * `subscription_id` - The subscription GUID. * `display_name` - The subscription display name. +* `tenant_id` - The subscription tenant ID. * `state` - The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. * `location_placement_id` - The subscription location placement ID. * `quota_id` - The subscription quota ID. From 6724a2d4a69e5bc2711781d1d657190c52c7b1a7 Mon Sep 17 00:00:00 2001 From: Eddie Ramirez Date: Mon, 8 Jul 2019 23:15:46 -0700 Subject: [PATCH 3/3] go mod vendor --- .../mgmt/{2016-06-01 => 2018-06-01}/subscriptions/client.go | 2 +- .../mgmt/{2016-06-01 => 2018-06-01}/subscriptions/models.go | 4 +++- .../{2016-06-01 => 2018-06-01}/subscriptions/operations.go | 2 +- .../subscriptions/subscriptions.go | 6 +++--- .../{2016-06-01 => 2018-06-01}/subscriptions/tenants.go | 2 +- .../{2016-06-01 => 2018-06-01}/subscriptions/version.go | 2 +- vendor/modules.txt | 4 ++-- 7 files changed, 12 insertions(+), 10 deletions(-) rename vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/{2016-06-01 => 2018-06-01}/subscriptions/client.go (98%) rename vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/{2016-06-01 => 2018-06-01}/subscriptions/models.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/{2016-06-01 => 2018-06-01}/subscriptions/operations.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/{2016-06-01 => 2018-06-01}/subscriptions/subscriptions.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/{2016-06-01 => 2018-06-01}/subscriptions/tenants.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/{2016-06-01 => 2018-06-01}/subscriptions/version.go (99%) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/client.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/client.go index 0195a20b36bf..3bf047ef1284 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/client.go @@ -1,4 +1,4 @@ -// Package subscriptions implements the Azure ARM Subscriptions service API version 2016-06-01. +// Package subscriptions implements the Azure ARM Subscriptions service API version 2018-06-01. // // All resource groups and resources exist within subscriptions. These operation enable you get information about your // subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/models.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/models.go index 99fc94173842..a9e35949de1b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/models.go @@ -26,7 +26,7 @@ import ( ) // The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions" +const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions" // SpendingLimit enumerates the values for spending limit. type SpendingLimit string @@ -421,6 +421,8 @@ type Subscription struct { SubscriptionID *string `json:"subscriptionId,omitempty"` // DisplayName - READ-ONLY; The subscription display name. DisplayName *string `json:"displayName,omitempty"` + // TenantID - READ-ONLY; The subscription tenant ID. + TenantID *string `json:"tenantId,omitempty"` // State - READ-ONLY; The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. Possible values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted' State State `json:"state,omitempty"` // SubscriptionPolicies - The subscription policies. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/operations.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/operations.go index 18079e576437..4065e29f4a40 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/operations.go @@ -78,7 +78,7 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2016-06-01" + const APIVersion = "2018-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/subscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/subscriptions.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/subscriptions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/subscriptions.go index df7ce71c824f..6ac21264e96d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/subscriptions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/subscriptions.go @@ -83,7 +83,7 @@ func (client Client) GetPreparer(ctx context.Context, subscriptionID string) (*h "subscriptionId": autorest.Encode("path", subscriptionID), } - const APIVersion = "2016-06-01" + const APIVersion = "2018-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client Client) List(ctx context.Context) (result ListResultPage, err error // ListPreparer prepares the List request. func (client Client) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2016-06-01" + const APIVersion = "2018-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -264,7 +264,7 @@ func (client Client) ListLocationsPreparer(ctx context.Context, subscriptionID s "subscriptionId": autorest.Encode("path", subscriptionID), } - const APIVersion = "2016-06-01" + const APIVersion = "2018-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/tenants.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/tenants.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/tenants.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/tenants.go index 3fc98f0db1c9..d4ce66997533 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/tenants.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/tenants.go @@ -78,7 +78,7 @@ func (client TenantsClient) List(ctx context.Context) (result TenantListResultPa // ListPreparer prepares the List request. func (client TenantsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2016-06-01" + const APIVersion = "2018-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/version.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/version.go index 599c1d099a3e..4309619234b8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " subscriptions/2016-06-01" + return "Azure-SDK-For-Go/" + version.Number + " subscriptions/2018-06-01" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/modules.txt b/vendor/modules.txt index f0ff15bc1c10..dba8ec1acc68 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -59,10 +59,10 @@ github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2016-06-01/reco github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2017-07-01/backup github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay -github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/policy github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources +github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus @@ -170,9 +170,9 @@ github.com/hashicorp/errwrap # github.com/hashicorp/go-azure-helpers v0.4.1 github.com/hashicorp/go-azure-helpers/authentication github.com/hashicorp/go-azure-helpers/resourceproviders +github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage github.com/hashicorp/go-azure-helpers/response -github.com/hashicorp/go-azure-helpers/sender # github.com/hashicorp/go-cleanhttp v0.5.0 github.com/hashicorp/go-cleanhttp # github.com/hashicorp/go-getter v1.3.0