diff --git a/internal/services/subscription/subscription_resource.go b/internal/services/subscription/subscription_resource.go index 58f32a88cb19..3d85fb01d69d 100644 --- a/internal/services/subscription/subscription_resource.go +++ b/internal/services/subscription/subscription_resource.go @@ -94,12 +94,6 @@ func resourceSubscription() *pluginsdk.Resource { }, }, - "management_group_id": { - Type: pluginsdk.TypeString, - Description: "The Management Group ID to which the subscription belongs", - Optional: true, - }, - "subscription_id": { Type: pluginsdk.TypeString, Description: "The GUID of the Subscription.", @@ -167,10 +161,6 @@ func resourceSubscriptionCreate(d *pluginsdk.ResourceData, meta interface{}) err }, } - if managementGroupIdRaw, ok := d.GetOk("management_group_id"); ok { - req.Properties.AdditionalProperties.ManagementGroupId = utils.ToPtr(managementGroupIdRaw.(string)) - } - subscriptionId := "" // Check if we're adding alias management for an existing subscription @@ -258,7 +248,6 @@ func resourceSubscriptionCreate(d *pluginsdk.ResourceData, meta interface{}) err func resourceSubscriptionUpdate(d *pluginsdk.ResourceData, meta interface{}) error { aliasClient := meta.(*clients.Client).Subscription.AliasClient subscriptionClient := meta.(*clients.Client).Subscription.SubscriptionClient - managementGroupsClient := meta.(*clients.Client).ManagementGroups.SubscriptionClient ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -291,22 +280,6 @@ func resourceSubscriptionUpdate(d *pluginsdk.ResourceData, meta interface{}) err } } - if d.HasChange("management_group_id") { - groupName := d.Get("management_group_id").(string) - if groupName != "" { - if _, err := managementGroupsClient.Create(ctx, groupName, *subscriptionId, "no-cache"); err != nil { - return fmt.Errorf("[DEBUG] Error assigning Subscription ID %q to Management Group %q: %+v", *subscriptionId, groupName, err) - } - } else if old, _ := d.GetChange("management_group_id"); old.(string) != "" { - deleteResp, err := managementGroupsClient.Delete(ctx, old.(string), *subscriptionId, "no-cache") - if err != nil { - if !response.WasNotFound(deleteResp.Response) { - return fmt.Errorf("unable to de-associate Subscription %q from Management Group %q: %+v", *subscriptionId, old.(string), err) - } - } - } - } - if d.HasChange("tags") { tagsClient := meta.(*clients.Client).Resource.TagsClientForSubscription(*subscriptionId) t := tags.Expand(d.Get("tags").(map[string]interface{}))