diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index 3cb40f5d2373..a038c804be02 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -331,7 +331,7 @@ service/stream-analytics: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_stream_analytics_((.|\n)*)###' service/subscription: - - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(extended_locations|subscription\W+|subscriptions)((.|\n)*)###' + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(extended_locations|location|subscription\W+|subscriptions)((.|\n)*)###' service/synapse: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_synapse_((.|\n)*)###' diff --git a/internal/clients/client.go b/internal/clients/client.go index 2e0718389718..f1a776d27bfb 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -594,7 +594,11 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error return fmt.Errorf("building Storage for StorageMover: %+v", err) } client.StreamAnalytics = streamAnalytics.NewClient(o) - client.Subscription = subscription.NewClient(o) + + if client.Subscription, err = subscription.NewClient(o); err != nil { + return fmt.Errorf("building clients for Subscription: %+v", err) + } + client.Synapse = synapse.NewClient(o) if client.TrafficManager, err = trafficManager.NewClient(o); err != nil { return fmt.Errorf("building clients for Traffic Manager: %+v", err) diff --git a/internal/provider/services.go b/internal/provider/services.go index fb457ac591d2..6c092f7c39be 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -199,6 +199,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { storage.Registration{}, storagemover.Registration{}, signalr.Registration{}, + subscription.Registration{}, orbital.Registration{}, streamanalytics.Registration{}, search.Registration{}, diff --git a/internal/services/subscription/client/client.go b/internal/services/subscription/client/client.go index 0039f4b89d20..36cdd4a6e7d3 100644 --- a/internal/services/subscription/client/client.go +++ b/internal/services/subscription/client/client.go @@ -4,25 +4,36 @@ package client import ( + "fmt" + "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-01-01/subscriptions" // nolint: staticcheck + resourceManager "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions" // nolint: staticcheck subscriptionAliasPandora "github.com/hashicorp/go-azure-sdk/resource-manager/subscription/2021-10-01/subscriptions" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - Client *subscriptions.Client - AliasClient *subscriptionAliasPandora.SubscriptionsClient + Client *subscriptions.Client + AliasClient *subscriptionAliasPandora.SubscriptionsClient + SubscriptionsClient *resourceManager.SubscriptionsClient } -func NewClient(o *common.ClientOptions) *Client { +func NewClient(o *common.ClientOptions) (*Client, error) { client := subscriptions.NewClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&client.Client, o.ResourceManagerAuthorizer) aliasClient := subscriptionAliasPandora.NewSubscriptionsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&aliasClient.Client, o.ResourceManagerAuthorizer) - return &Client{ - AliasClient: &aliasClient, - Client: &client, + subscriptionsClient, err := resourceManager.NewSubscriptionsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Subscriptions client: %+v", err) } + o.Configure(subscriptionsClient.Client, o.Authorizers.ResourceManager) + + return &Client{ + AliasClient: &aliasClient, + Client: &client, + SubscriptionsClient: subscriptionsClient, + }, nil } diff --git a/internal/services/subscription/location_data_source.go b/internal/services/subscription/location_data_source.go new file mode 100644 index 000000000000..6a46d2a6a115 --- /dev/null +++ b/internal/services/subscription/location_data_source.go @@ -0,0 +1,151 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package subscription + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + resourcesSubscription "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ sdk.DataSource = LocationDataSource{} + +type LocationDataSource struct{} + +type LocationDataSourceModel struct { + Location string `tfschema:"location"` + DisplayName string `tfschema:"display_name"` + ZoneMappings []LocationZoneMapping `tfschema:"zone_mappings"` +} + +type LocationZoneMapping struct { + LogicalZone string `tfschema:"logical_zone"` + PhysicalZone string `tfschema:"physical_zone"` +} + +func (r LocationDataSource) ResourceType() string { + return "azurerm_location" +} + +func (r LocationDataSource) ModelObject() interface{} { + return &LocationDataSourceModel{} +} + +func (r LocationDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationWithoutForceNew(), + } +} + +func (r LocationDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "display_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "zone_mappings": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "logical_zone": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "physical_zone": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + } +} + +func (r LocationDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Subscription.SubscriptionsClient + subscriptionId := metadata.Client.Account.SubscriptionId + + id := commonids.NewSubscriptionID(subscriptionId) + resp, err := client.ListLocations(ctx, id, resourcesSubscription.DefaultListLocationsOperationOptions()) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if resp.Model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + if resp.Model.Value == nil { + return fmt.Errorf("retrieving %s: model value was nil", id) + } + + var model LocationDataSourceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + normalizedLocation := location.Normalize(model.Location) + + locationValue, err := getLocation(normalizedLocation, resp.Model.Value) + if err != nil { + return err + } + + var state LocationDataSourceModel + state.ZoneMappings = flattenZonesMapping(locationValue) + state.DisplayName = pointer.From(locationValue.DisplayName) + state.Location = normalizedLocation + + metadata.ResourceData.SetId(fmt.Sprintf("%s/locations/%s", id.ID(), normalizedLocation)) + + return metadata.Encode(&state) + }, + } +} + +func getLocation(location string, input *[]resourcesSubscription.Location) (*resourcesSubscription.Location, error) { + for _, item := range *input { + if pointer.From(item.Name) == location && pointer.From(item.Metadata.RegionType) == "Physical" { + return &item, nil + } + } + + return nil, fmt.Errorf("no location was found for %q", location) +} + +func flattenZonesMapping(location *resourcesSubscription.Location) (zoneMappings []LocationZoneMapping) { + zoneMappings = make([]LocationZoneMapping, 0) + + if location == nil || location.AvailabilityZoneMappings == nil { + return zoneMappings + } + + for _, zoneMapping := range *location.AvailabilityZoneMappings { + locationZoneMapping := LocationZoneMapping{ + LogicalZone: pointer.From(zoneMapping.LogicalZone), + PhysicalZone: pointer.From(zoneMapping.PhysicalZone), + } + + zoneMappings = append(zoneMappings, locationZoneMapping) + } + + return zoneMappings +} diff --git a/internal/services/subscription/location_data_source_test.go b/internal/services/subscription/location_data_source_test.go new file mode 100644 index 000000000000..78b43d225dd4 --- /dev/null +++ b/internal/services/subscription/location_data_source_test.go @@ -0,0 +1,57 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package subscription_test + +import ( + "fmt" + "regexp" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type LocationsDataSource struct{} + +func TestAccLocationDataSource_NonExistingRegion(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_location", "test") + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: LocationsDataSource{}.basic("not-existing-region"), + ExpectError: regexp.MustCompile("\"not-existing-region\" was not found in the list of supported Azure Locations"), + }, + }) +} + +func TestAccLocationDataSource_westUS(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_location", "test") + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: LocationsDataSource{}.basic("westus"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("display_name").HasValue("West US"), + check.That(data.ResourceName).Key("zone_mappings.0.logical_zone").HasValue("1"), + check.That(data.ResourceName).Key("zone_mappings.1.logical_zone").HasValue("2"), + check.That(data.ResourceName).Key("zone_mappings.2.logical_zone").HasValue("3"), + check.That(data.ResourceName).Key("zone_mappings.0.physical_zone").IsNotEmpty(), + check.That(data.ResourceName).Key("zone_mappings.1.physical_zone").IsNotEmpty(), + check.That(data.ResourceName).Key("zone_mappings.2.physical_zone").IsNotEmpty(), + ), + }, + }) +} + +func (d LocationsDataSource) basic(location string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +data "azurerm_location" "test" { + location = "%s" +} +`, location) +} diff --git a/internal/services/subscription/registration.go b/internal/services/subscription/registration.go index c8f44c5a49f8..2262d0d6b7db 100644 --- a/internal/services/subscription/registration.go +++ b/internal/services/subscription/registration.go @@ -10,7 +10,10 @@ import ( type Registration struct{} -var _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +var ( + _ sdk.TypedServiceRegistrationWithAGitHubLabel = Registration{} + _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +) func (r Registration) AssociatedGitHubLabel() string { return "service/subscription" @@ -43,3 +46,13 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_subscription": resourceSubscription(), } } + +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{ + LocationDataSource{}, + } +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{} +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/README.md new file mode 100644 index 000000000000..6132a3443975 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions` Documentation + +The `subscriptions` SDK allows for interaction with the Azure Resource Manager Service `resources` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions" +``` + + +### Client Initialization + +```go +client := subscriptions.NewSubscriptionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SubscriptionsClient.CheckZonePeers` + +```go +ctx := context.TODO() +id := subscriptions.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := subscriptions.CheckZonePeersRequest{ + // ... +} + + +read, err := client.CheckZonePeers(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionsClient.Get` + +```go +ctx := context.TODO() +id := subscriptions.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionsClient.List` + +```go +ctx := context.TODO() + + +// alternatively `client.List(ctx)` can be used to do batched pagination +items, err := client.ListComplete(ctx) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SubscriptionsClient.ListLocations` + +```go +ctx := context.TODO() +id := subscriptions.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.ListLocations(ctx, id, subscriptions.DefaultListLocationsOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/client.go new file mode 100644 index 000000000000..09be7cb1cfb0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/client.go @@ -0,0 +1,26 @@ +package subscriptions + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionsClient struct { + Client *resourcemanager.Client +} + +func NewSubscriptionsClientWithBaseURI(sdkApi sdkEnv.Api) (*SubscriptionsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "subscriptions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SubscriptionsClient: %+v", err) + } + + return &SubscriptionsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/constants.go new file mode 100644 index 000000000000..6a0623c63899 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/constants.go @@ -0,0 +1,230 @@ +package subscriptions + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LocationType string + +const ( + LocationTypeEdgeZone LocationType = "EdgeZone" + LocationTypeRegion LocationType = "Region" +) + +func PossibleValuesForLocationType() []string { + return []string{ + string(LocationTypeEdgeZone), + string(LocationTypeRegion), + } +} + +func (s *LocationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLocationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLocationType(input string) (*LocationType, error) { + vals := map[string]LocationType{ + "edgezone": LocationTypeEdgeZone, + "region": LocationTypeRegion, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LocationType(input) + return &out, nil +} + +type RegionCategory string + +const ( + RegionCategoryExtended RegionCategory = "Extended" + RegionCategoryOther RegionCategory = "Other" + RegionCategoryRecommended RegionCategory = "Recommended" +) + +func PossibleValuesForRegionCategory() []string { + return []string{ + string(RegionCategoryExtended), + string(RegionCategoryOther), + string(RegionCategoryRecommended), + } +} + +func (s *RegionCategory) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRegionCategory(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRegionCategory(input string) (*RegionCategory, error) { + vals := map[string]RegionCategory{ + "extended": RegionCategoryExtended, + "other": RegionCategoryOther, + "recommended": RegionCategoryRecommended, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RegionCategory(input) + return &out, nil +} + +type RegionType string + +const ( + RegionTypeLogical RegionType = "Logical" + RegionTypePhysical RegionType = "Physical" +) + +func PossibleValuesForRegionType() []string { + return []string{ + string(RegionTypeLogical), + string(RegionTypePhysical), + } +} + +func (s *RegionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRegionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRegionType(input string) (*RegionType, error) { + vals := map[string]RegionType{ + "logical": RegionTypeLogical, + "physical": RegionTypePhysical, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RegionType(input) + return &out, nil +} + +type SpendingLimit string + +const ( + SpendingLimitCurrentPeriodOff SpendingLimit = "CurrentPeriodOff" + SpendingLimitOff SpendingLimit = "Off" + SpendingLimitOn SpendingLimit = "On" +) + +func PossibleValuesForSpendingLimit() []string { + return []string{ + string(SpendingLimitCurrentPeriodOff), + string(SpendingLimitOff), + string(SpendingLimitOn), + } +} + +func (s *SpendingLimit) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSpendingLimit(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSpendingLimit(input string) (*SpendingLimit, error) { + vals := map[string]SpendingLimit{ + "currentperiodoff": SpendingLimitCurrentPeriodOff, + "off": SpendingLimitOff, + "on": SpendingLimitOn, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SpendingLimit(input) + return &out, nil +} + +type SubscriptionState string + +const ( + SubscriptionStateDeleted SubscriptionState = "Deleted" + SubscriptionStateDisabled SubscriptionState = "Disabled" + SubscriptionStateEnabled SubscriptionState = "Enabled" + SubscriptionStatePastDue SubscriptionState = "PastDue" + SubscriptionStateWarned SubscriptionState = "Warned" +) + +func PossibleValuesForSubscriptionState() []string { + return []string{ + string(SubscriptionStateDeleted), + string(SubscriptionStateDisabled), + string(SubscriptionStateEnabled), + string(SubscriptionStatePastDue), + string(SubscriptionStateWarned), + } +} + +func (s *SubscriptionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSubscriptionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSubscriptionState(input string) (*SubscriptionState, error) { + vals := map[string]SubscriptionState{ + "deleted": SubscriptionStateDeleted, + "disabled": SubscriptionStateDisabled, + "enabled": SubscriptionStateEnabled, + "pastdue": SubscriptionStatePastDue, + "warned": SubscriptionStateWarned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SubscriptionState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_checkzonepeers.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_checkzonepeers.go new file mode 100644 index 000000000000..ccf0d2b62f70 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_checkzonepeers.go @@ -0,0 +1,57 @@ +package subscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckZonePeersOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckZonePeersResult +} + +// CheckZonePeers ... +func (c SubscriptionsClient) CheckZonePeers(ctx context.Context, id commonids.SubscriptionId, input CheckZonePeersRequest) (result CheckZonePeersOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.Resources/checkZonePeers", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_get.go new file mode 100644 index 000000000000..999742ed26f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_get.go @@ -0,0 +1,52 @@ +package subscriptions + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Subscription +} + +// Get ... +func (c SubscriptionsClient) Get(ctx context.Context, id commonids.SubscriptionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_list.go new file mode 100644 index 000000000000..db7e3d7eaa78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_list.go @@ -0,0 +1,89 @@ +package subscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Subscription +} + +type ListCompleteResult struct { + Items []Subscription +} + +// List ... +func (c SubscriptionsClient) List(ctx context.Context) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: "/subscriptions", + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Subscription `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c SubscriptionsClient) ListComplete(ctx context.Context) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, SubscriptionOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SubscriptionsClient) ListCompleteMatchingPredicate(ctx context.Context, predicate SubscriptionOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Subscription, 0) + + resp, err := c.List(ctx) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_listlocations.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_listlocations.go new file mode 100644 index 000000000000..ec0312f45404 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/method_listlocations.go @@ -0,0 +1,81 @@ +package subscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListLocationsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LocationListResult +} + +type ListLocationsOperationOptions struct { + IncludeExtendedLocations *bool +} + +func DefaultListLocationsOperationOptions() ListLocationsOperationOptions { + return ListLocationsOperationOptions{} +} + +func (o ListLocationsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListLocationsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListLocationsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.IncludeExtendedLocations != nil { + out.Append("includeExtendedLocations", fmt.Sprintf("%v", *o.IncludeExtendedLocations)) + } + return &out +} + +// ListLocations ... +func (c SubscriptionsClient) ListLocations(ctx context.Context, id commonids.SubscriptionId, options ListLocationsOperationOptions) (result ListLocationsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/locations", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_availabilityzonemappings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_availabilityzonemappings.go new file mode 100644 index 000000000000..bcc2161084b6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_availabilityzonemappings.go @@ -0,0 +1,9 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilityZoneMappings struct { + LogicalZone *string `json:"logicalZone,omitempty"` + PhysicalZone *string `json:"physicalZone,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_availabilityzonepeers.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_availabilityzonepeers.go new file mode 100644 index 000000000000..b781bc0a41fe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_availabilityzonepeers.go @@ -0,0 +1,9 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilityZonePeers struct { + AvailabilityZone *string `json:"availabilityZone,omitempty"` + Peers *[]Peers `json:"peers,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_checkzonepeersrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_checkzonepeersrequest.go new file mode 100644 index 000000000000..a7182c1c1e1b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_checkzonepeersrequest.go @@ -0,0 +1,9 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckZonePeersRequest struct { + Location *string `json:"location,omitempty"` + SubscriptionIds *[]string `json:"subscriptionIds,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_checkzonepeersresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_checkzonepeersresult.go new file mode 100644 index 000000000000..40750aae5417 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_checkzonepeersresult.go @@ -0,0 +1,10 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckZonePeersResult struct { + AvailabilityZonePeers *[]AvailabilityZonePeers `json:"availabilityZonePeers,omitempty"` + Location *string `json:"location,omitempty"` + SubscriptionId *string `json:"subscriptionId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_location.go new file mode 100644 index 000000000000..427d45330452 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_location.go @@ -0,0 +1,15 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Location struct { + AvailabilityZoneMappings *[]AvailabilityZoneMappings `json:"availabilityZoneMappings,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Id *string `json:"id,omitempty"` + Metadata *LocationMetadata `json:"metadata,omitempty"` + Name *string `json:"name,omitempty"` + RegionalDisplayName *string `json:"regionalDisplayName,omitempty"` + SubscriptionId *string `json:"subscriptionId,omitempty"` + Type *LocationType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_locationlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_locationlistresult.go new file mode 100644 index 000000000000..7cc6e662b6c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_locationlistresult.go @@ -0,0 +1,8 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LocationListResult struct { + Value *[]Location `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_locationmetadata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_locationmetadata.go new file mode 100644 index 000000000000..1667133626e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_locationmetadata.go @@ -0,0 +1,16 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LocationMetadata struct { + Geography *string `json:"geography,omitempty"` + GeographyGroup *string `json:"geographyGroup,omitempty"` + HomeLocation *string `json:"homeLocation,omitempty"` + Latitude *string `json:"latitude,omitempty"` + Longitude *string `json:"longitude,omitempty"` + PairedRegion *[]PairedRegion `json:"pairedRegion,omitempty"` + PhysicalLocation *string `json:"physicalLocation,omitempty"` + RegionCategory *RegionCategory `json:"regionCategory,omitempty"` + RegionType *RegionType `json:"regionType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_managedbytenant.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_managedbytenant.go new file mode 100644 index 000000000000..69445358affa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_managedbytenant.go @@ -0,0 +1,8 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedByTenant struct { + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_pairedregion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_pairedregion.go new file mode 100644 index 000000000000..761fbd7252ab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_pairedregion.go @@ -0,0 +1,10 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PairedRegion struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + SubscriptionId *string `json:"subscriptionId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_peers.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_peers.go new file mode 100644 index 000000000000..4fb021596416 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_peers.go @@ -0,0 +1,9 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Peers struct { + AvailabilityZone *string `json:"availabilityZone,omitempty"` + SubscriptionId *string `json:"subscriptionId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_subscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_subscription.go new file mode 100644 index 000000000000..1bd7b96b6d50 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_subscription.go @@ -0,0 +1,16 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Subscription struct { + AuthorizationSource *string `json:"authorizationSource,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Id *string `json:"id,omitempty"` + ManagedByTenants *[]ManagedByTenant `json:"managedByTenants,omitempty"` + State *SubscriptionState `json:"state,omitempty"` + SubscriptionId *string `json:"subscriptionId,omitempty"` + SubscriptionPolicies *SubscriptionPolicies `json:"subscriptionPolicies,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_subscriptionpolicies.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_subscriptionpolicies.go new file mode 100644 index 000000000000..c96c88aafaf9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/model_subscriptionpolicies.go @@ -0,0 +1,10 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionPolicies struct { + LocationPlacementId *string `json:"locationPlacementId,omitempty"` + QuotaId *string `json:"quotaId,omitempty"` + SpendingLimit *SpendingLimit `json:"spendingLimit,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/predicates.go new file mode 100644 index 000000000000..530385c2544b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/predicates.go @@ -0,0 +1,37 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionOperationPredicate struct { + AuthorizationSource *string + DisplayName *string + Id *string + SubscriptionId *string + TenantId *string +} + +func (p SubscriptionOperationPredicate) Matches(input Subscription) bool { + + if p.AuthorizationSource != nil && (input.AuthorizationSource == nil || *p.AuthorizationSource != *input.AuthorizationSource) { + return false + } + + if p.DisplayName != nil && (input.DisplayName == nil || *p.DisplayName != *input.DisplayName) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.SubscriptionId != nil && (input.SubscriptionId == nil || *p.SubscriptionId != *input.SubscriptionId) { + return false + } + + if p.TenantId != nil && (input.TenantId == nil || *p.TenantId != *input.TenantId) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/version.go new file mode 100644 index 000000000000..fdd4fbe1e588 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions/version.go @@ -0,0 +1,12 @@ +package subscriptions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/subscriptions/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index ed14c8d88d06..1088f586ab04 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -874,6 +874,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/resources/2021-07-01/features github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-02-01/templatespecversions github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-06-01/policyassignments github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-09-01/providers +github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-12-01/subscriptions github.com/hashicorp/go-azure-sdk/resource-manager/resources/2023-07-01/resourcegroups github.com/hashicorp/go-azure-sdk/resource-manager/search/2022-09-01/services github.com/hashicorp/go-azure-sdk/resource-manager/search/2023-11-01/adminkeys diff --git a/website/docs/d/location.html.markdown b/website/docs/d/location.html.markdown new file mode 100644 index 000000000000..1f073a31d9ec --- /dev/null +++ b/website/docs/d/location.html.markdown @@ -0,0 +1,50 @@ +--- +subcategory: "Base" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_location" +description: |- + Get information of a specific location. +--- + +# Data Source: azurerm_location + +Use this data source to access information of a specific physical location. + +## Example Usage + +```hcl +data "azurerm_location" "example" { + location = "West Europe" +} +``` + +## Argument Reference + +* `location` - (Required) Specifies the supported Azure location where the resource exists. + +## Attributes Reference + +* `id` - The ID of Location within this Subscription. + +* `region_type` - The available region type. Possible values are `Physical` and `Logical`. + +* `display_name` - The display name of the location. + +* `zone_mappings` - A `zone_mappings` block as defined below. + +--- + +A `zone_mappings` block exports the following: + +* `logical_zone` - The logical zone id for the availability zone + +* `physical_zone` - The fully qualified physical zone id of availability zone to which logical zone id is mapped to + + +--- + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Location.