diff --git a/azuread/config.go b/azuread/config.go index 93b2b59eb9..aea3c2ab5b 100644 --- a/azuread/config.go +++ b/azuread/config.go @@ -19,7 +19,6 @@ import ( // ArmClient contains the handles to all the specific Azure ADger resource classes' respective clients. type ArmClient struct { - subscriptionID string clientID string objectID string tenantID string @@ -57,7 +56,6 @@ func getArmClient(authCfg *authentication.Config, tfVersion string, ctx context. // client declarations: client := ArmClient{ - subscriptionID: authCfg.SubscriptionID, clientID: authCfg.ClientID, objectID: objectID, tenantID: authCfg.TenantID, diff --git a/azuread/provider.go b/azuread/provider.go index 37d7d5572a..4e68aa87b2 100644 --- a/azuread/provider.go +++ b/azuread/provider.go @@ -12,10 +12,11 @@ import ( func Provider() terraform.ResourceProvider { p := &schema.Provider{ Schema: map[string]*schema.Schema{ + // TODO: remove subscription_id field at next major version "subscription_id": { - Type: schema.TypeString, - Optional: true, - DefaultFunc: schema.EnvDefaultFunc("ARM_SUBSCRIPTION_ID", ""), + Type: schema.TypeString, + Optional: true, + Default: "", }, "client_id": { @@ -100,11 +101,13 @@ func Provider() terraform.ResourceProvider { func providerConfigure(p *schema.Provider) schema.ConfigureFunc { return func(d *schema.ResourceData) (interface{}, error) { + // When constructing the Builder, we use the tenant ID for the subscription ID. + // Although this has no effect since we never consume it, this practise mimics + // the Azure CLI and it seems the most sensible value to use after a nonsense string. builder := &authentication.Builder{ - // TODO: remove the requirement on the Subscription ID - SubscriptionID: d.Get("subscription_id").(string), ClientID: d.Get("client_id").(string), ClientSecret: d.Get("client_secret").(string), + SubscriptionID: d.Get("tenant_id").(string), TenantID: d.Get("tenant_id").(string), Environment: d.Get("environment").(string), MsiEndpoint: d.Get("msi_endpoint").(string), diff --git a/azuread/provider_test.go b/azuread/provider_test.go index 04264f369b..627a374397 100644 --- a/azuread/provider_test.go +++ b/azuread/provider_test.go @@ -32,7 +32,6 @@ func TestProvider_impl(t *testing.T) { func testAccPreCheck(t *testing.T) { variables := []string{ - "ARM_SUBSCRIPTION_ID", "ARM_CLIENT_ID", "ARM_CLIENT_SECRET", "ARM_TENANT_ID",