Skip to content

Commit

Permalink
merge latest change
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-yechenwei committed Nov 6, 2024
2 parents 572d2d5 + b837a43 commit d977704
Show file tree
Hide file tree
Showing 102 changed files with 7,109 additions and 935 deletions.
2 changes: 1 addition & 1 deletion .github/labeler-issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ service/spring:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(spring_cloud_accelerator\W+|spring_cloud_active_deployment\W+|spring_cloud_api_portal\W+|spring_cloud_api_portal_custom_domain\W+|spring_cloud_app\W+|spring_cloud_app_cosmosdb_association\W+|spring_cloud_app_dynamics_application_performance_monitoring\W+|spring_cloud_app_mysql_association\W+|spring_cloud_app_redis_association\W+|spring_cloud_application_insights_application_performance_monitoring\W+|spring_cloud_application_live_view\W+|spring_cloud_build_deployment\W+|spring_cloud_build_pack_binding\W+|spring_cloud_builder\W+|spring_cloud_certificate\W+|spring_cloud_configuration_service\W+|spring_cloud_container_deployment\W+|spring_cloud_custom_domain\W+|spring_cloud_customized_accelerator\W+|spring_cloud_dev_tool_portal\W+|spring_cloud_dynatrace_application_performance_monitoring\W+|spring_cloud_elastic_application_performance_monitoring\W+|spring_cloud_gateway\W+|spring_cloud_gateway_custom_domain\W+|spring_cloud_gateway_route_config\W+|spring_cloud_java_deployment\W+|spring_cloud_new_relic_application_performance_monitoring\W+|spring_cloud_service\W+|spring_cloud_storage\W+)((.|\n)*)###'

service/storage:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(storage_account\W+|storage_account_blob_container_sas\W+|storage_account_customer_managed_key\W+|storage_account_local_user\W+|storage_account_network_rules\W+|storage_account_sas\W+|storage_blob\W+|storage_blob_inventory_policy\W+|storage_container\W+|storage_container_immutability_policy\W+|storage_containers\W+|storage_data_lake_gen2_filesystem\W+|storage_data_lake_gen2_path\W+|storage_encryption_scope\W+|storage_management_policy\W+|storage_object_replication\W+|storage_queue\W+|storage_share\W+|storage_share_directory\W+|storage_share_file\W+|storage_sync\W+|storage_sync_cloud_endpoint\W+|storage_sync_group\W+|storage_sync_server_endpoint\W+|storage_table\W+|storage_table\W+|storage_table_entities\W+|storage_table_entity\W+)((.|\n)*)###'
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(storage_account\W+|storage_account_blob_container_sas\W+|storage_account_customer_managed_key\W+|storage_account_local_user\W+|storage_account_network_rules\W+|storage_account_queue_properties\W+|storage_account_sas\W+|storage_account_static_website\W+|storage_blob\W+|storage_blob_inventory_policy\W+|storage_container\W+|storage_container_immutability_policy\W+|storage_containers\W+|storage_data_lake_gen2_filesystem\W+|storage_data_lake_gen2_path\W+|storage_encryption_scope\W+|storage_management_policy\W+|storage_object_replication\W+|storage_queue\W+|storage_share\W+|storage_share_directory\W+|storage_share_file\W+|storage_sync\W+|storage_sync_cloud_endpoint\W+|storage_sync_group\W+|storage_sync_server_endpoint\W+|storage_table\W+|storage_table\W+|storage_table_entities\W+|storage_table_entity\W+)((.|\n)*)###'

service/storagemover:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_storage_mover((.|\n)*)###'
Expand Down
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
## 4.9.0 (Unreleased)

FEATURES:

* **New Resource**: `azurerm_dashboard_grafana_managed_private_endpoint` [GH-27781]
* **New Resource**: `azurerm_data_protection_backup_instance_mysql_flexible_server` [GH-27464]

ENHANCEMENTS:

* `azurerm_oracle_cloud_vm_cluster` - add support for the `domain`, `scan_listener_port_tcp`, `scan_listener_port_tcp_ssl` and `zone_id` properties [GH-27808]
* dependencies - update `go-azure-sdk` to `v0.20241104.1140654` [GH-27896]
* dependencies - update `go-azure-helpers` to `v0.71.0` [GH-27897]
* `azurerm_public_ip_prefix` - add support for the `sku_tier` property [GH-27882]
* `azurerm_oracle_cloud_vm_cluster` - add support for the `domain`, `scan_listener_port_tcp`, `scan_listener_port_tcp_ssl` and `zone_id` properties [GH-27808]
* `azurerm_public_ip` - support for the d`omain_name_label_scope` property [GH-27748]
* `storage` - allow `azurerm_storage_account` to be used in Data Plane restrictive environments [GH-27818]
* `azurerm_subnet` - `default_outbound_access_enabled` can now be updated [GH-27858]
* `azurerm_storage_container` - support for the `storage_account_id` property [GH-27733]
* `azurerm_storage_share` - support for the `storage_account_id` property [GH-27733]

## 4.8.0 (October 31, 2024)

Expand Down Expand Up @@ -59,7 +71,7 @@ FEATURES:

ENHANCEMENTS:

* Dependencies - update `go-azure-sdk` to `v0.20241021.1074254` ([#27713](https://github.com/hashicorp/terraform-provider-azurerm/issues/27713))
* dependencies - update `go-azure-sdk` to `v0.20241021.1074254` ([#27713](https://github.com/hashicorp/terraform-provider-azurerm/issues/27713))
* `newrelic` - upgrade api version to `2024-03-01` ([#27135](https://github.com/hashicorp/terraform-provider-azurerm/issues/27135))
* `cosmosdb` - upgrade api version to `2024-08-15` ([#27659](https://github.com/hashicorp/terraform-provider-azurerm/issues/27659))
* `azurerm_application_gateway` - support for the new `Basic` SKU value ([#27440](https://github.com/hashicorp/terraform-provider-azurerm/issues/27440))
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ require (
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
github.com/hashicorp/go-azure-helpers v0.70.1
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241021.1074254
github.com/hashicorp/go-azure-sdk/sdk v0.20241021.1074254
github.com/hashicorp/go-azure-helpers v0.71.0
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241104.1140654
github.com/hashicorp/go-azure-sdk/sdk v0.20241104.1140654
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-uuid v1.0.3
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ github.com/hashicorp/errwrap v0.0.0-20180715044906-d6c0cd880357/go.mod h1:YH+1FK
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-azure-helpers v0.70.1 h1:7hlnRrZobMZxpOzdlNEsayzAayj/KRG4wpDS1jgo4GM=
github.com/hashicorp/go-azure-helpers v0.70.1/go.mod h1:BmbF4JDYXK5sEmFeU5hcn8Br21uElcqLfdQxjatwQKw=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241021.1074254 h1:HkfUWlUIfivTGMoTH3j4KsuKN3HGBv58zhuVDizTeUQ=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241021.1074254/go.mod h1:JILPz8H5GILFudutdlFv4BxmwK+k53/91jnd7KtPxbc=
github.com/hashicorp/go-azure-sdk/sdk v0.20241021.1074254 h1:u9xvP60m/rlIv5p4b+sewB98UOT9CGTHoOY7BkiX27Y=
github.com/hashicorp/go-azure-sdk/sdk v0.20241021.1074254/go.mod h1:dMKF6bXrgGmy1d3pLzkmBpG2JIHgSAV2/OMSCEgyMwE=
github.com/hashicorp/go-azure-helpers v0.71.0 h1:ra3aIRzg01g6MLKQ+yABcb6WJtrqRUDDgyuPLmyZ9lY=
github.com/hashicorp/go-azure-helpers v0.71.0/go.mod h1:BmbF4JDYXK5sEmFeU5hcn8Br21uElcqLfdQxjatwQKw=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241104.1140654 h1:mJJ+LO2Xdu5S+Ccie0QTGXEupuVZfkQqCZ2/IOMeDIo=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241104.1140654/go.mod h1:JFrQrK0Pbn0ynhgcnIsgD9lp1xq0vaRVtnxvPFiar1U=
github.com/hashicorp/go-azure-sdk/sdk v0.20241104.1140654 h1:DxQDXVDMu2Jkli2KAWvwU2+fR9I7W5U2dKpwUAkARig=
github.com/hashicorp/go-azure-sdk/sdk v0.20241104.1140654/go.mod h1:dMKF6bXrgGmy1d3pLzkmBpG2JIHgSAV2/OMSCEgyMwE=
github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU=
github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
Expand Down
3 changes: 3 additions & 0 deletions internal/features/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ func Default() UserFeatures {
RollInstancesWhenRequired: true,
ScaleToZeroOnDelete: true,
},
Storage: StorageFeatures{
DataPlaneAvailable: true,
},
Subscription: SubscriptionFeatures{
PreventCancellationOnDestroy: false,
},
Expand Down
5 changes: 5 additions & 0 deletions internal/features/user_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type UserFeatures struct {
ResourceGroup ResourceGroupFeatures
RecoveryServicesVault RecoveryServicesVault
ManagedDisk ManagedDiskFeatures
Storage StorageFeatures
Subscription SubscriptionFeatures
PostgresqlFlexibleServer PostgresqlFlexibleServerFeatures
MachineLearning MachineLearningFeatures
Expand Down Expand Up @@ -84,6 +85,10 @@ type AppConfigurationFeatures struct {
RecoverSoftDeleted bool
}

type StorageFeatures struct {
DataPlaneAvailable bool
}

type SubscriptionFeatures struct {
PreventCancellationOnDestroy bool
}
Expand Down
24 changes: 24 additions & 0 deletions internal/provider/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,21 @@ func schemaFeatures(supportLegacyTestSuite bool) *pluginsdk.Schema {
},
},

"storage": {
Type: pluginsdk.TypeList,
Optional: true,
MaxItems: 1,
Elem: &pluginsdk.Resource{
Schema: map[string]*schema.Schema{
"data_plane_available": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: true,
},
},
},
},

"subscription": {
Type: pluginsdk.TypeList,
Optional: true,
Expand Down Expand Up @@ -580,6 +595,15 @@ func expandFeatures(input []interface{}) features.UserFeatures {
}
}
}
if raw, ok := val["storage"]; ok {
items := raw.([]interface{})
if len(items) > 0 {
storageRaw := items[0].(map[string]interface{})
if v, ok := storageRaw["data_plane_available"]; ok {
featuresMap.Storage.DataPlaneAvailable = v.(bool)
}
}
}

if raw, ok := val["subscription"]; ok {
items := raw.([]interface{})
Expand Down
67 changes: 67 additions & 0 deletions internal/provider/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ func TestExpandFeatures(t *testing.T) {
RecoveryServicesVault: features.RecoveryServicesVault{
RecoverSoftDeletedBackupProtectedVM: true,
},
Storage: features.StorageFeatures{
DataPlaneAvailable: true,
},
Subscription: features.SubscriptionFeatures{
PreventCancellationOnDestroy: false,
},
Expand Down Expand Up @@ -156,6 +159,11 @@ func TestExpandFeatures(t *testing.T) {
"recover_soft_deleted_backup_protected_vm": true,
},
},
"storage": []interface{}{
map[string]interface{}{
"data_plane_available": true,
},
},
"subscription": []interface{}{
map[string]interface{}{
"prevent_cancellation_on_destroy": true,
Expand Down Expand Up @@ -235,6 +243,9 @@ func TestExpandFeatures(t *testing.T) {
RecoveryServicesVault: features.RecoveryServicesVault{
RecoverSoftDeletedBackupProtectedVM: true,
},
Storage: features.StorageFeatures{
DataPlaneAvailable: true,
},
Subscription: features.SubscriptionFeatures{
PreventCancellationOnDestroy: true,
},
Expand Down Expand Up @@ -331,6 +342,11 @@ func TestExpandFeatures(t *testing.T) {
"recover_soft_deleted_backup_protected_vm": false,
},
},
"storage": []interface{}{
map[string]interface{}{
"data_plane_available": false,
},
},
"subscription": []interface{}{
map[string]interface{}{
"prevent_cancellation_on_destroy": false,
Expand Down Expand Up @@ -410,6 +426,9 @@ func TestExpandFeatures(t *testing.T) {
RecoveryServicesVault: features.RecoveryServicesVault{
RecoverSoftDeletedBackupProtectedVM: false,
},
Storage: features.StorageFeatures{
DataPlaneAvailable: false,
},
Subscription: features.SubscriptionFeatures{
PreventCancellationOnDestroy: false,
},
Expand Down Expand Up @@ -1431,6 +1450,54 @@ func TestExpandFeaturesManagedDisk(t *testing.T) {
}
}

func TestExpandFeaturesStorage(t *testing.T) {
testData := []struct {
Name string
Input []interface{}
EnvVars map[string]interface{}
Expected features.UserFeatures
}{
{
Name: "Empty Block",
Input: []interface{}{
map[string]interface{}{
"storage": []interface{}{},
},
},
Expected: features.UserFeatures{
Storage: features.StorageFeatures{
DataPlaneAvailable: true,
},
},
},
{
Name: "Storage Data Plane on Create is Disabled",
Input: []interface{}{
map[string]interface{}{
"storage": []interface{}{
map[string]interface{}{
"data_plane_available": false,
},
},
},
},
Expected: features.UserFeatures{
Storage: features.StorageFeatures{
DataPlaneAvailable: false,
},
},
},
}

for _, testCase := range testData {
t.Logf("[DEBUG] Test Case: %q", testCase.Name)
result := expandFeatures(testCase.Input)
if !reflect.DeepEqual(result.Storage, testCase.Expected.Storage) {
t.Fatalf("Expected %+v but got %+v", result.Storage, testCase.Expected.Storage)
}
}
}

func TestExpandFeaturesSubscription(t *testing.T) {
testData := []struct {
Name string
Expand Down
13 changes: 13 additions & 0 deletions internal/provider/framework/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,19 @@ func (p *ProviderConfig) Load(ctx context.Context, data *ProviderModel, tfVersio
f.ManagedDisk.ExpandWithoutDowntime = true
}

if !features.Storage.IsNull() && !features.Storage.IsUnknown() {
var feature []Storage
d := features.Storage.ElementsAs(ctx, &feature, true)
diags.Append(d...)
if diags.HasError() {
return
}
f.Storage.DataPlaneAvailable = true
if !feature[0].DataPlaneAvailable.IsNull() && !feature[0].DataPlaneAvailable.IsUnknown() {
f.Storage.DataPlaneAvailable = feature[0].DataPlaneAvailable.ValueBool()
}
}

if !features.Subscription.IsNull() && !features.Subscription.IsUnknown() {
var feature []Subscription
d := features.Subscription.ElementsAs(ctx, &feature, true)
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/framework/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ func defaultFeaturesList() types.List {
})
managedDiskList, _ := basetypes.NewListValue(types.ObjectType{}.WithAttributeTypes(ManagedDiskAttributes), []attr.Value{managedDisk})

storage, _ := basetypes.NewObjectValueFrom(context.Background(), StorageAttributes, map[string]attr.Value{
"data_plane_available": basetypes.NewBoolNull(),
})
storageList, _ := basetypes.NewListValue(types.ObjectType{}.WithAttributeTypes(StorageAttributes), []attr.Value{storage})

subscription, _ := basetypes.NewObjectValueFrom(context.Background(), SubscriptionAttributes, map[string]attr.Value{
"prevent_cancellation_on_destroy": basetypes.NewBoolNull(),
})
Expand Down Expand Up @@ -314,6 +319,7 @@ func defaultFeaturesList() types.List {
"virtual_machine_scale_set": virtualMachineScaleSetList,
"resource_group": resourceGroupList,
"managed_disk": managedDiskList,
"storage": storageList,
"subscription": subscriptionList,
"postgresql_flexible_server": postgresqlFlexibleServerList,
"machine_learning": machineLearningList,
Expand Down
10 changes: 10 additions & 0 deletions internal/provider/framework/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type Features struct {
VirtualMachineScaleSet types.List `tfsdk:"virtual_machine_scale_set"`
ResourceGroup types.List `tfsdk:"resource_group"`
ManagedDisk types.List `tfsdk:"managed_disk"`
Storage types.List `tfsdk:"storage"`
Subscription types.List `tfsdk:"subscription"`
PostgresqlFlexibleServer types.List `tfsdk:"postgresql_flexible_server"`
MachineLearning types.List `tfsdk:"machine_learning"`
Expand All @@ -73,6 +74,7 @@ var FeaturesAttributes = map[string]attr.Type{
"virtual_machine_scale_set": types.ListType{}.WithElementType(types.ObjectType{}.WithAttributeTypes(VirtualMachineScaleSetAttributes)),
"resource_group": types.ListType{}.WithElementType(types.ObjectType{}.WithAttributeTypes(ResourceGroupAttributes)),
"managed_disk": types.ListType{}.WithElementType(types.ObjectType{}.WithAttributeTypes(ManagedDiskAttributes)),
"storage": types.ListType{}.WithElementType(types.ObjectType{}.WithAttributeTypes(StorageAttributes)),
"subscription": types.ListType{}.WithElementType(types.ObjectType{}.WithAttributeTypes(SubscriptionAttributes)),
"postgresql_flexible_server": types.ListType{}.WithElementType(types.ObjectType{}.WithAttributeTypes(PostgresqlFlexibleServerAttributes)),
"machine_learning": types.ListType{}.WithElementType(types.ObjectType{}.WithAttributeTypes(MachineLearningAttributes)),
Expand Down Expand Up @@ -204,6 +206,14 @@ var ManagedDiskAttributes = map[string]attr.Type{
"expand_without_downtime": types.BoolType,
}

type Storage struct {
DataPlaneAvailable types.Bool `tfsdk:"data_plane_available"`
}

var StorageAttributes = map[string]attr.Type{
"data_plane_available": types.BoolType,
}

type Subscription struct {
PreventCancellationOnDestroy types.Bool `tfsdk:"prevent_cancellation_on_destroy"`
}
Expand Down
9 changes: 9 additions & 0 deletions internal/provider/framework/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,15 @@ func (p *azureRmFrameworkProvider) Schema(_ context.Context, _ provider.SchemaRe
},
},
},
"storage": schema.ListNestedBlock{
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
"data_plane_available": schema.BoolAttribute{
Optional: true,
},
},
},
},
"subscription": schema.ListNestedBlock{
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,6 @@ func TestAccAutomationJobSchedule_complete(t *testing.T) {
})
}

func TestAccAutomationJobSchedule_update(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_automation_job_schedule", "test")
r := AutomationJobScheduleResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
{
Config: r.complete(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

func TestAccAutomationJobSchedule_updateRunbook(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_automation_job_schedule", "test")
r := AutomationJobScheduleResource{}
Expand Down
Loading

0 comments on commit d977704

Please sign in to comment.