Skip to content

Commit

Permalink
azurerm_subscription - update subscription client version to 2018-06-…
Browse files Browse the repository at this point in the history
…01 & support the `tenant_id` property (#3811)

update subscription client version from 2016-06-01 to 2018-06-01.
also support TenantID in Subscription type.
  • Loading branch information
eddieramirez authored and katbyte committed Jul 9, 2019
1 parent b895922 commit c0fe594
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions azurerm/data_source_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions azurerm/data_source_subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
},
Expand All @@ -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"),
Expand Down
3 changes: 3 additions & 0 deletions azurerm/data_source_subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions azurerm/data_source_subscriptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
},
Expand Down
5 changes: 5 additions & 0 deletions azurerm/helpers/azure/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/subscription.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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 @@ -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.
Expand Down

0 comments on commit c0fe594

Please sign in to comment.