Skip to content

Commit b04259b

Browse files
committed
git merge main
2 parents 2511743 + ac5e769 commit b04259b

File tree

616 files changed

+2465
-620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

616 files changed

+2465
-620
lines changed

.release/provider-schema.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
## 4.63.0 (March 05, 2026)
2+
3+
FEATURES:
4+
5+
* provider: added the `enhanced_validation` block with the `locations` and `resource_providers` properties to replace the `ARM_PROVIDER_ENHANCED_VALIDATION` environment variable ([#31678](https://github.com/hashicorp/terraform-provider-azurerm/issues/31678))
6+
7+
ENHANCEMENTS:
8+
9+
* `azurerm_site_recovery_replicated_vm`- add support for `PremiumV2_LRS` in the `target_replica_disk_type` property ([#31890](https://github.com/hashicorp/terraform-provider-azurerm/issues/31890))
10+
11+
BUG FIXES:
12+
13+
* `azurerm_analysis_services_server` - fix an issue that prevented creation of the resource with `power_bi_service_enabled` set to `false` and one or more `ipv4_firewall_rule` blocks defined ([#31870](https://github.com/hashicorp/terraform-provider-azurerm/issues/31870))
14+
* `azurerm_analysis_services_server` - fix an issue that prevented adding or removing `ipv4_firewall_rule` blocks without also modifying `power_bi_service_enabled` ([#31870](https://github.com/hashicorp/terraform-provider-azurerm/issues/31870))
15+
* `azurerm_linux_web_app`, `azurerm_windows_web_app`, `azurerm_windows_function_app`, `azurerm_linux_function_app`, `azurerm_function_app_flex_consumption` - fix API error when removing auth_settings_v2 configuration from a previously deployed appservice ([#31821](https://github.com/hashicorp/terraform-provider-azurerm/issues/31821)) ([#31821](https://github.com/hashicorp/terraform-provider-azurerm/issues/31821))
16+
* dependencies: `dataprotection` - downgrade to API version `2025-07-01` due to new validation introduced by Azure on `2025-09-01` that is blocking deployments ([#31877](https://github.com/hashicorp/terraform-provider-azurerm/issues/31877))
17+
18+
## 4.62.1 (March 02, 2026)
19+
20+
BUG FIXES:
21+
22+
* `azurerm_data_factory` - fix removal of `customer_managed_key_identity_id` to no longer send an empty string to Azure, instead sending an empty object ([#31858](https://github.com/hashicorp/terraform-provider-azurerm/issues/31858))
23+
* `azurerm_data_factory_customer_managed_key` - fix a persistent ID parsing error on `user_assigned_identity_id` when Azure returned an empty string ([#31858](https://github.com/hashicorp/terraform-provider-azurerm/issues/31858))
24+
* `azurerm_data_factory_customer_managed_key` - fix removal of `user_assigned_identity_id` to no longer send an empty string to Azure, instead sending an empty object ([#31858](https://github.com/hashicorp/terraform-provider-azurerm/issues/31858))
25+
* `azurerm_linux_function_app_slot` - fix an issue that prevented users from deploying a slot to a container-based function app ([#31842](https://github.com/hashicorp/terraform-provider-azurerm/issues/31842))
26+
127
## 4.62.0 (February 26, 2026)
228

329
FEATURES:

contributing/topics/reference-documentation-standards.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,6 @@ A `block_attribute` exports the following:
118118
119119
```
120120

121-
## Timeouts
122-
123-
When documenting timeouts, use the updated link format for all new resources:
124-
125-
- **New resources**: Use `https://developer.hashicorp.com/terraform/language/resources/configure#define-operation-timeouts`
126-
- **Existing resources**: Continue using `https://www.terraform.io/language/resources/syntax#operation-timeouts` to maintain consistency
127-
128121
## Notes
129122

130123
Note blocks are used to provide additional information to users beyond the basic description of a resource, argument or attribute.

internal/clients/builder.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,19 @@ func Build(ctx context.Context, builder ClientBuilder) (*Client, error) {
156156
return nil, fmt.Errorf("building Client: %+v", err)
157157
}
158158

159-
if features.EnhancedValidationEnabled() {
159+
if builder.Features.EnhancedValidation.Locations {
160+
ctx2, cancel := context.WithTimeout(ctx, 10*time.Minute)
161+
defer cancel()
162+
163+
location.CacheSupportedLocations(ctx2, *resourceManagerEndpoint)
164+
}
165+
166+
if builder.Features.EnhancedValidation.ResourceProviders {
160167
subscriptionId := commonids.NewSubscriptionID(client.Account.SubscriptionId)
161168

162169
ctx2, cancel := context.WithTimeout(ctx, 10*time.Minute)
163170
defer cancel()
164171

165-
location.CacheSupportedLocations(ctx2, *resourceManagerEndpoint)
166172
if err := resourceproviders.CacheSupportedProviders(ctx2, client.Resource.ResourceProvidersClient, subscriptionId); err != nil {
167173
log.Printf("[DEBUG] error retrieving providers: %s. Enhanced validation will be unavailable", err)
168174
}

internal/features/defaults.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ func Default() UserFeatures {
1010
PurgeSoftDeleteOnDestroy: true,
1111
RecoverSoftDeleted: true,
1212
},
13+
EnhancedValidation: EnhancedValidationFeatures{
14+
Locations: !FivePointOh(),
15+
ResourceProviders: !FivePointOh(),
16+
},
1317
AppConfiguration: AppConfigurationFeatures{
1418
PurgeSoftDeleteOnDestroy: true,
1519
RecoverSoftDeleted: true,

internal/features/enhanced_validation.go

Lines changed: 87 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,105 @@
44
package features
55

66
import (
7+
"fmt"
78
"os"
89
"strings"
910
)
1011

1112
// EnhancedValidationEnabled returns whether the feature for Enhanced Validation is enabled.
1213
//
1314
// This functionality calls out to the Azure MetaData Service to cache the list of supported
14-
// Azure Locations for the specified Endpoint - and then uses that to provide enhanced validation
15+
// Azure Locations and Resource Providers for the specified Endpoint - and then uses that to
16+
// provide enhanced validation. When enabled, invalid locations or resource providers are caught
17+
// at `terraform plan` time. When disabled, these errors are caught at `terraform apply` time
18+
// when Azure rejects the request.
1519
//
16-
// This is enabled by default as of version 2.20 of the Azure Provider, and can be disabled by
17-
// setting the Environment Variable `ARM_PROVIDER_ENHANCED_VALIDATION` to `false`.
20+
// This is enabled by default in version 4.x and disabled by default as of version 5.0 of the
21+
// Azure Provider. The default can be overridden by setting the Environment Variable
22+
// `ARM_PROVIDER_ENHANCED_VALIDATION` to `true` or `false`.
1823
func EnhancedValidationEnabled() bool {
1924
value := os.Getenv("ARM_PROVIDER_ENHANCED_VALIDATION")
2025
if value == "" {
21-
return true
26+
// In 5.0, default to disabled; in 4.x, default to enabled
27+
return !FivePointOh()
2228
}
2329

2430
return strings.EqualFold(value, "true")
2531
}
32+
33+
// EnhancedValidationLocationsEnabled returns whether Enhanced Validation for Locations is enabled.
34+
//
35+
// This checks the `ARM_PROVIDER_ENHANCED_VALIDATION_LOCATIONS` environment variable first,
36+
// falling back to the legacy `ARM_PROVIDER_ENHANCED_VALIDATION` environment variable, then to the
37+
// version default (enabled in 4.x, disabled in 5.0).
38+
func EnhancedValidationLocationsEnabled() bool {
39+
// Check the locations-specific env var first
40+
value := os.Getenv("ARM_PROVIDER_ENHANCED_VALIDATION_LOCATIONS")
41+
if value != "" {
42+
return strings.EqualFold(value, "true")
43+
}
44+
45+
// In 4.x, fall back to the legacy environment variable
46+
if !FivePointOh() {
47+
return EnhancedValidationEnabled()
48+
}
49+
50+
// In 5.0, default to disabled
51+
return false
52+
}
53+
54+
// EnhancedValidationResourceProvidersEnabled returns whether Enhanced Validation for Resource Providers is enabled.
55+
//
56+
// This checks the `ARM_PROVIDER_ENHANCED_VALIDATION_RESOURCE_PROVIDERS` environment variable first,
57+
// falling back to the legacy `ARM_PROVIDER_ENHANCED_VALIDATION` environment variable, then to the
58+
// version default (enabled in 4.x, disabled in 5.0).
59+
func EnhancedValidationResourceProvidersEnabled() bool {
60+
// Check the resource-providers-specific env var first
61+
value := os.Getenv("ARM_PROVIDER_ENHANCED_VALIDATION_RESOURCE_PROVIDERS")
62+
if value != "" {
63+
return strings.EqualFold(value, "true")
64+
}
65+
66+
// In 4.x, fall back to the legacy environment variable
67+
if !FivePointOh() {
68+
return EnhancedValidationEnabled()
69+
}
70+
71+
// In 5.0, default to disabled
72+
return false
73+
}
74+
75+
// ValidateEnhancedValidationEnvVars validates the enhanced validation environment variables.
76+
//
77+
// In version 5.0, the legacy `ARM_PROVIDER_ENHANCED_VALIDATION` environment variable has been
78+
// removed - an error is returned if it is set, directing users to migrate to the specific
79+
// environment variables or the `enhanced_validation` provider block.
80+
//
81+
// In version 4.x, the legacy environment variable is still supported, but it cannot be set
82+
// at the same time as any of the specific environment variables.
83+
func ValidateEnhancedValidationEnvVars() error {
84+
legacyEnv := os.Getenv("ARM_PROVIDER_ENHANCED_VALIDATION")
85+
if legacyEnv == "" {
86+
return nil
87+
}
88+
89+
// In 5.0, the legacy env var is no longer supported
90+
if FivePointOh() {
91+
return fmt.Errorf("the environment variable `ARM_PROVIDER_ENHANCED_VALIDATION` has been removed in v5.0 of the AzureRM Provider - please use the `enhanced_validation` provider block or the replacement environment variables `ARM_PROVIDER_ENHANCED_VALIDATION_LOCATIONS` and `ARM_PROVIDER_ENHANCED_VALIDATION_RESOURCE_PROVIDERS` instead")
92+
}
93+
94+
// In 4.x, check for conflicts with specific env vars
95+
var conflicts []string
96+
if v := os.Getenv("ARM_PROVIDER_ENHANCED_VALIDATION_LOCATIONS"); v != "" {
97+
conflicts = append(conflicts, "ARM_PROVIDER_ENHANCED_VALIDATION_LOCATIONS")
98+
}
99+
if v := os.Getenv("ARM_PROVIDER_ENHANCED_VALIDATION_RESOURCE_PROVIDERS"); v != "" {
100+
conflicts = append(conflicts, "ARM_PROVIDER_ENHANCED_VALIDATION_RESOURCE_PROVIDERS")
101+
}
102+
103+
if len(conflicts) > 0 {
104+
return fmt.Errorf("the environment variable `ARM_PROVIDER_ENHANCED_VALIDATION` cannot be set at the same time as %v - please either use the legacy `ARM_PROVIDER_ENHANCED_VALIDATION` or the replacement environment variables, but not both", conflicts)
105+
}
106+
107+
return nil
108+
}

internal/features/user_flags.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ type UserFeatures struct {
88
AppConfiguration AppConfigurationFeatures
99
ApplicationInsights ApplicationInsightFeatures
1010
CognitiveAccount CognitiveAccountFeatures
11+
EnhancedValidation EnhancedValidationFeatures
1112
VirtualMachine VirtualMachineFeatures
1213
VirtualMachineScaleSet VirtualMachineScaleSetFeatures
1314
KeyVault KeyVaultFeatures
@@ -29,6 +30,11 @@ type CognitiveAccountFeatures struct {
2930
PurgeSoftDeleteOnDestroy bool
3031
}
3132

33+
type EnhancedValidationFeatures struct {
34+
Locations bool
35+
ResourceProviders bool
36+
}
37+
3238
type VirtualMachineFeatures struct {
3339
DetachImplicitDataDiskOnDeletion bool
3440
DeleteOSDiskOnDeletion bool

internal/provider/features_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ func TestExpandFeatures(t *testing.T) {
3535
CognitiveAccount: features.CognitiveAccountFeatures{
3636
PurgeSoftDeleteOnDestroy: true,
3737
},
38+
EnhancedValidation: features.EnhancedValidationFeatures{
39+
Locations: true,
40+
ResourceProviders: true,
41+
},
3842
KeyVault: features.KeyVaultFeatures{
3943
PurgeSoftDeletedCertsOnDestroy: true,
4044
PurgeSoftDeletedKeysOnDestroy: true,
@@ -236,6 +240,10 @@ func TestExpandFeatures(t *testing.T) {
236240
CognitiveAccount: features.CognitiveAccountFeatures{
237241
PurgeSoftDeleteOnDestroy: true,
238242
},
243+
EnhancedValidation: features.EnhancedValidationFeatures{
244+
Locations: true,
245+
ResourceProviders: true,
246+
},
239247
KeyVault: features.KeyVaultFeatures{
240248
PurgeSoftDeletedCertsOnDestroy: true,
241249
PurgeSoftDeletedKeysOnDestroy: true,
@@ -437,6 +445,10 @@ func TestExpandFeatures(t *testing.T) {
437445
CognitiveAccount: features.CognitiveAccountFeatures{
438446
PurgeSoftDeleteOnDestroy: false,
439447
},
448+
EnhancedValidation: features.EnhancedValidationFeatures{
449+
Locations: true,
450+
ResourceProviders: true,
451+
},
440452
KeyVault: features.KeyVaultFeatures{
441453
PurgeSoftDeletedCertsOnDestroy: false,
442454
PurgeSoftDeletedKeysOnDestroy: false,

internal/provider/framework/config.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,36 @@ func (p *ProviderConfig) Load(ctx context.Context, data *ProviderModel, tfVersio
126126
p.clientBuilder.DisableCorrelationRequestID = getEnvBoolOrDefault(data.DisableCorrelationRequestId, "ARM_DISABLE_CORRELATION_REQUEST_ID", false)
127127
p.clientBuilder.DisableTerraformPartnerID = getEnvBoolOrDefault(data.DisableTerraformPartnerId, "ARM_DISABLE_TERRAFORM_PARTNER_ID", false)
128128
p.clientBuilder.StorageUseAzureAD = getEnvBoolOrDefault(data.StorageUseAzureAD, "ARM_STORAGE_USE_AZUREAD", false)
129+
// In 4.x, validate that the legacy and specific enhanced validation env vars don't conflict
130+
if !providerfeatures.FivePointOh() {
131+
if err := providerfeatures.ValidateEnhancedValidationEnvVars(); err != nil {
132+
diags.Append(diag.NewErrorDiagnostic("validating enhanced validation environment variables", err.Error()))
133+
return
134+
}
135+
} else if os.Getenv("ARM_PROVIDER_ENHANCED_VALIDATION") != "" {
136+
diags.Append(diag.NewErrorDiagnostic("unsupported environment variable", "the environment variable `ARM_PROVIDER_ENHANCED_VALIDATION` has been removed in v5.0 of the AzureRM Provider - please use the `enhanced_validation` provider block or the replacement environment variables `ARM_PROVIDER_ENHANCED_VALIDATION_LOCATIONS` and `ARM_PROVIDER_ENHANCED_VALIDATION_RESOURCE_PROVIDERS` instead"))
137+
return
138+
}
139+
140+
// Read enhanced_validation block
141+
enhancedValidationLocations := providerfeatures.EnhancedValidationLocationsEnabled()
142+
enhancedValidationResourceProviders := providerfeatures.EnhancedValidationResourceProvidersEnabled()
143+
if !data.EnhancedValidation.IsNull() && !data.EnhancedValidation.IsUnknown() {
144+
var evList []EnhancedValidationModel
145+
d := data.EnhancedValidation.ElementsAs(ctx, &evList, true)
146+
diags.Append(d...)
147+
if diags.HasError() {
148+
return
149+
}
150+
if len(evList) > 0 {
151+
if !evList[0].Locations.IsNull() && !evList[0].Locations.IsUnknown() {
152+
enhancedValidationLocations = evList[0].Locations.ValueBool()
153+
}
154+
if !evList[0].ResourceProviders.IsNull() && !evList[0].ResourceProviders.IsUnknown() {
155+
enhancedValidationResourceProviders = evList[0].ResourceProviders.ValueBool()
156+
}
157+
}
158+
}
129159

130160
f := providerfeatures.UserFeatures{}
131161

@@ -521,6 +551,9 @@ func (p *ProviderConfig) Load(ctx context.Context, data *ProviderModel, tfVersio
521551
}
522552
}
523553

554+
f.EnhancedValidation.Locations = enhancedValidationLocations
555+
f.EnhancedValidation.ResourceProviders = enhancedValidationResourceProviders
556+
524557
p.clientBuilder.Features = f
525558
p.clientBuilder.AuthConfig = authConfig
526559
p.clientBuilder.CustomCorrelationRequestID = os.Getenv("ARM_CORRELATION_REQUEST_ID")

internal/provider/framework/config_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ func TestProviderConfig_LoadDefault(t *testing.T) {
2626
t.Skip("ARM_CLIENT_SECRET env var not set")
2727
}
2828

29-
// Skip enhanced validation
30-
t.Setenv("ARM_PROVIDER_ENHANCED_VALIDATION", "false")
29+
enhancedValidation, _ := basetypes.NewObjectValueFrom(context.Background(), EnhancedValidationModelAttributes, map[string]attr.Value{
30+
"locations": basetypes.NewBoolValue(false),
31+
"resource_providers": basetypes.NewBoolValue(false),
32+
})
33+
enhancedValidationList, _ := basetypes.NewListValue(types.ObjectType{}.WithAttributeTypes(EnhancedValidationModelAttributes), []attr.Value{enhancedValidation})
3134

3235
testData := &ProviderModel{
3336
ResourceProviderRegistrations: types.StringValue("none"),
3437
Features: defaultFeaturesList(),
38+
EnhancedValidation: enhancedValidationList,
3539
}
3640

3741
testConfig.Load(context.Background(), testData, "unittest", &diag.Diagnostics{})

0 commit comments

Comments
 (0)