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

azurerm_subscription - update subscription client version to 2018-06-01 & support the tenant_id property #3811

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
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