diff --git a/internal/services/subscription/data_source_location.go b/internal/services/subscription/location_data_source.go similarity index 94% rename from internal/services/subscription/data_source_location.go rename to internal/services/subscription/location_data_source.go index df1e5b97202a6..6a46d2a6a115e 100644 --- a/internal/services/subscription/data_source_location.go +++ b/internal/services/subscription/location_data_source.go @@ -24,7 +24,6 @@ type LocationDataSource struct{} type LocationDataSourceModel struct { Location string `tfschema:"location"` - RegionType string `tfschema:"region_type"` DisplayName string `tfschema:"display_name"` ZoneMappings []LocationZoneMapping `tfschema:"zone_mappings"` } @@ -50,10 +49,6 @@ func (r LocationDataSource) Arguments() map[string]*pluginsdk.Schema { func (r LocationDataSource) Attributes() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ - "region_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, "display_name": { Type: pluginsdk.TypeString, Computed: true, @@ -116,7 +111,6 @@ func (r LocationDataSource) Read() sdk.ResourceFunc { var state LocationDataSourceModel state.ZoneMappings = flattenZonesMapping(locationValue) - state.RegionType = string(pointer.From(locationValue.Metadata.RegionType)) state.DisplayName = pointer.From(locationValue.DisplayName) state.Location = normalizedLocation @@ -129,7 +123,7 @@ func (r LocationDataSource) Read() sdk.ResourceFunc { func getLocation(location string, input *[]resourcesSubscription.Location) (*resourcesSubscription.Location, error) { for _, item := range *input { - if pointer.From(item.Name) == location { + if pointer.From(item.Name) == location && pointer.From(item.Metadata.RegionType) == "Physical" { return &item, nil } } diff --git a/internal/services/subscription/data_source_location_test.go b/internal/services/subscription/location_data_source_test.go similarity index 89% rename from internal/services/subscription/data_source_location_test.go rename to internal/services/subscription/location_data_source_test.go index de4e2f8207246..78b43d225dd41 100644 --- a/internal/services/subscription/data_source_location_test.go +++ b/internal/services/subscription/location_data_source_test.go @@ -14,7 +14,7 @@ import ( type LocationsDataSource struct{} -func TestAccDataSourceLocation_NonExistingRegion(t *testing.T) { +func TestAccLocationDataSource_NonExistingRegion(t *testing.T) { data := acceptance.BuildTestData(t, "data.azurerm_location", "test") data.DataSourceTest(t, []acceptance.TestStep{ @@ -25,14 +25,13 @@ func TestAccDataSourceLocation_NonExistingRegion(t *testing.T) { }) } -func TestAccDataSourceLocation_westUS(t *testing.T) { +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("region_type").HasValue("Physical"), 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"), diff --git a/website/docs/d/location.html.markdown b/website/docs/d/location.html.markdown index 5893120eaef01..1f073a31d9ec9 100644 --- a/website/docs/d/location.html.markdown +++ b/website/docs/d/location.html.markdown @@ -8,7 +8,7 @@ description: |- # Data Source: azurerm_location -Use this data source to access information of a specific location. +Use this data source to access information of a specific physical location. ## Example Usage @@ -47,4 +47,4 @@ A `zone_mappings` block exports the following: 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 Extended Locations. +* `read` - (Defaults to 5 minutes) Used when retrieving the Location.