Skip to content

Commit

Permalink
Merge branch 'hashicorp:main' into nginxaas_nap
Browse files Browse the repository at this point in the history
  • Loading branch information
arpith-f5 authored Sep 27, 2024
2 parents 9ad26b2 + fa13433 commit 795f4cb
Show file tree
Hide file tree
Showing 8,781 changed files with 32,241 additions and 38,163 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 1 addition & 2 deletions .teamcity/components/build_azure.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,5 @@ fun ParametrizedWithType.ConfigureAzureSpecificTestParameters(environment: Strin
hiddenVariable("env.ARM_TEST_LOCATION", locationsForEnv.primary, "The Primary region which should be used for testing")
hiddenVariable("env.ARM_TEST_LOCATION_ALT", locationsForEnv.secondary, "The Secondary region which should be used for testing")
hiddenVariable("env.ARM_TEST_LOCATION_ALT2", locationsForEnv.tertiary, "The Tertiary region which should be used for testing")
hiddenVariable("env.ARM_THREEPOINTZERO_BETA", "true", "Opt into the use of 3.0 beta resources")
hiddenVariable("env.ARM_FOURPOINTZERO_BETA", "true", "Opt into the use of 4.0 beta resources")
hiddenVariable("env.ARM_FIVEPOINTZERO_BETA", "false", "Opt into the 5.0 beta")
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 4.4.0 (Unreleased)

ENHANCEMENTS:

* dependencies - update `github.com/hashicorp/go-azure-sdk` to `v0.20240923.1151247` [GH-27491]
* `azurerm_site_recovery_replicated_vm` - support for the `target_virtual_machine_size` property [GH-27480]

## 4.3.0 (September 19, 2024)

FEATURES:
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ require (
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.20240906.1232634
github.com/hashicorp/go-azure-sdk/sdk v0.20240906.1232634
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240923.1151247
github.com/hashicorp/go-azure-sdk/sdk v0.20240923.1151247
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
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY
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.20240906.1232634 h1:hsjAS5gcfhn5FdCiZ08nuAsvQJtlTEsGxJDxqBT6zoA=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240906.1232634/go.mod h1:0IyF1dmWLHTZak+t9eQeg0VZ7rA/5du4swTm99NX+6I=
github.com/hashicorp/go-azure-sdk/sdk v0.20240906.1232634 h1:FGtv7+jcrx2m35qEKjK177zRXoBmPn3WntuqtqjcHwM=
github.com/hashicorp/go-azure-sdk/sdk v0.20240906.1232634/go.mod h1:dMKF6bXrgGmy1d3pLzkmBpG2JIHgSAV2/OMSCEgyMwE=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240923.1151247 h1:G0gRbm6sT00wzkQeCexQzdH58QO6Liwd19V0wJSoVCA=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240923.1151247/go.mod h1:JBcndQhypLhEDHUK7HNmM2e8WrEAnEua7SiJuw/z/po=
github.com/hashicorp/go-azure-sdk/sdk v0.20240923.1151247 h1:kzNr/Oqfn72C+k9rL5/G/T3maNo1d87u1aAgjNsKOEQ=
github.com/hashicorp/go-azure-sdk/sdk v0.20240923.1151247/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
18 changes: 15 additions & 3 deletions internal/features/five_point_oh.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@

package features

import (
"os"
"strings"
)

// nolint gocritic
// DeprecatedInFivePointOh returns the deprecation message if the provider
// is running in 4.0 mode - otherwise is returns an empty string (such that
// is running in 5.0 mode - otherwise returns an empty string (such that
// this deprecation should be ignored).
// This can be used for the following scenarios:
// - Signify resources which will be Deprecated in 5.0, but not Removed (which will happen in a later release).
Expand All @@ -18,7 +23,7 @@ func DeprecatedInFivePointOh(deprecationMessage string) string {
return deprecationMessage
}

// FourPointOh returns whether this provider is running in 5.0 mode
// FivePointOh returns whether this provider is running in 5.0 mode
// that is to say - the final 5.0 release
//
// This exists to allow breaking changes to be piped through the provider
Expand All @@ -32,6 +37,13 @@ func FivePointOh() bool {
//
// This exists to allow breaking changes to be piped through the provider
// during the development of 4.x until 5.0 is ready.
//
// The environment variable `ARM_FIVEPOINTZERO_BETA` has been added
// to facilitate testing. But it should be noted that
// `ARM_FIVEPOINTZERO_BETA` is ** NOT READY FOR PUBLIC USE ** and
// ** SHOULD NOT BE SET IN PRODUCTION ENVIRONMENTS **
// Setting `ARM_FIVEPOINTZERO_BETA` will cause irreversible changes
// to your state.
func FivePointOhBeta() bool {
return FivePointOh() || false
return FivePointOh() || strings.EqualFold(os.Getenv("ARM_FIVEPOINTZERO_BETA"), "true")
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2022-08-01/logger"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/set"
Expand Down Expand Up @@ -115,12 +114,6 @@ func resourceApiManagementDiagnostic() *pluginsdk.Resource {
"operation_name_format": {
Type: pluginsdk.TypeString,
Optional: true,
Default: func() interface{} {
if !features.FourPointOh() {
return string(diagnostic.OperationNameFormatName)
}
return nil
}(),
ValidateFunc: validation.StringInSlice([]string{
string(diagnostic.OperationNameFormatName),
string(diagnostic.OperationNameFormatUrl),
Expand Down Expand Up @@ -160,8 +153,6 @@ func resourceApiManagementDiagnosticCreateUpdate(d *pluginsdk.ResourceData, meta
if d.Get("identifier") == "applicationinsights" {
if operationNameFormat, ok := d.GetOk("operation_name_format"); ok {
parameters.Properties.OperationNameFormat = pointer.To(diagnostic.OperationNameFormat(operationNameFormat.(string)))
} else if !features.FourPointOh() {
parameters.Properties.OperationNameFormat = pointer.To(diagnostic.OperationNameFormatName)
}
}

Expand Down Expand Up @@ -274,9 +265,6 @@ func resourceApiManagementDiagnosticRead(d *pluginsdk.ResourceData, meta interfa
}

format := ""
if !features.FourPointOh() {
format = string(diagnostic.OperationNameFormatName)
}
if props.OperationNameFormat != nil {
format = string(pointer.From(props.OperationNameFormat))
}
Expand Down
33 changes: 33 additions & 0 deletions internal/services/authorization/models.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package authorization

import "github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2020-10-01/rolemanagementpolicies"

var _ rolemanagementpolicies.RoleManagementPolicyRule = RoleManagementPolicyRule{}

// RoleManagementPolicyRule is a temporary workaround because the child models for rolemanagementpolicies.RoleManagementPolicyRule
// do not yet exist, due to issues resolving these child types in the Pandora importer.
// TODO: replace this type with the correct child models from the SDK package, once they are implemented
type RoleManagementPolicyRule struct {
Id *string `json:"id,omitempty"`
RuleType rolemanagementpolicies.RoleManagementPolicyRuleType `json:"ruleType"`

ClaimValue *string `json:"claimValue,omitempty"`
EnabledRules *[]string `json:"enabledRules,omitempty"`
IsDefaultRecipientsEnabled *bool `json:"isDefaultRecipientsEnabled"`
IsEnabled *bool `json:"isEnabled,omitempty"`
IsExpirationRequired *bool `json:"isExpirationRequired,omitempty"`
MaximumDuration *string `json:"maximumDuration,omitempty"`
NotificationLevel *string `json:"notificationLevel"`
NotificationRecipients *[]string `json:"notificationRecipients"`
NotificationType *string `json:"notificationType"`
RecipientType *string `json:"recipientType"`
Setting map[string]interface{} `json:"setting,omitempty"`
Target map[string]interface{} `json:"target,omitempty"`
}

func (r RoleManagementPolicyRule) RoleManagementPolicyRule() rolemanagementpolicies.BaseRoleManagementPolicyRuleImpl {
return rolemanagementpolicies.BaseRoleManagementPolicyRuleImpl{
Id: r.Id,
RuleType: r.RuleType,
}
}
94 changes: 47 additions & 47 deletions internal/services/authorization/role_management_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ func buildRoleManagementPolicyForUpdate(metadata *sdk.ResourceMetaData, rolePoli
target = targetRaw.(map[string]interface{})
}

updatedRules = append(updatedRules, map[string]interface{}{
"id": id,
"ruleType": ruleType,
"target": target,
"isExpirationRequired": expirationRequired,
"maximumDuration": maximumDuration,
updatedRules = append(updatedRules, RoleManagementPolicyRule{
Id: pointer.To(id),
RuleType: rolemanagementpolicies.RoleManagementPolicyRuleType(ruleType),
Target: target,
IsExpirationRequired: pointer.To(expirationRequired),
MaximumDuration: pointer.To(maximumDuration),
})
}
}
Expand Down Expand Up @@ -143,11 +143,11 @@ func buildRoleManagementPolicyForUpdate(metadata *sdk.ResourceMetaData, rolePoli
target = targetRaw.(map[string]interface{})
}

updatedRules = append(updatedRules, map[string]interface{}{
"id": id,
"ruleType": ruleType,
"target": target,
"enabledRules": enabledRules,
updatedRules = append(updatedRules, RoleManagementPolicyRule{
Id: pointer.To(id),
RuleType: rolemanagementpolicies.RoleManagementPolicyRuleType(ruleType),
Target: target,
EnabledRules: pointer.To(enabledRules),
})
}
}
Expand Down Expand Up @@ -187,12 +187,12 @@ func buildRoleManagementPolicyForUpdate(metadata *sdk.ResourceMetaData, rolePoli
target = targetRaw.(map[string]interface{})
}

updatedRules = append(updatedRules, map[string]interface{}{
"id": id,
"ruleType": ruleType,
"target": target,
"isExpirationRequired": expirationRequired,
"maximumDuration": maximumDuration,
updatedRules = append(updatedRules, RoleManagementPolicyRule{
Id: pointer.To(id),
RuleType: rolemanagementpolicies.RoleManagementPolicyRuleType(ruleType),
Target: target,
IsExpirationRequired: pointer.To(expirationRequired),
MaximumDuration: pointer.To(maximumDuration),
})
}
}
Expand All @@ -214,11 +214,11 @@ func buildRoleManagementPolicyForUpdate(metadata *sdk.ResourceMetaData, rolePoli
maximumDuration = model.ActivationRules[0].MaximumDuration
}

updatedRules = append(updatedRules, map[string]interface{}{
"id": id,
"ruleType": ruleType,
"target": target,
"maximumDuration": maximumDuration,
updatedRules = append(updatedRules, RoleManagementPolicyRule{
Id: pointer.To(id),
RuleType: rolemanagementpolicies.RoleManagementPolicyRuleType(ruleType),
Target: target,
MaximumDuration: pointer.To(maximumDuration),
})
}
}
Expand Down Expand Up @@ -288,11 +288,11 @@ func buildRoleManagementPolicyForUpdate(metadata *sdk.ResourceMetaData, rolePoli
target = targetRaw.(map[string]interface{})
}

updatedRules = append(updatedRules, map[string]interface{}{
"id": id,
"ruleType": ruleType,
"target": target,
"setting": map[string]interface{}{
updatedRules = append(updatedRules, RoleManagementPolicyRule{
Id: pointer.To(id),
RuleType: rolemanagementpolicies.RoleManagementPolicyRuleType(ruleType),
Target: target,
Setting: map[string]interface{}{
"isApprovalRequired": approvalReqd,
"approvalStages": approvalStages,
},
Expand Down Expand Up @@ -327,12 +327,12 @@ func buildRoleManagementPolicyForUpdate(metadata *sdk.ResourceMetaData, rolePoli
target = targetRaw.(map[string]interface{})
}

updatedRules = append(updatedRules, map[string]interface{}{
"id": id,
"ruleType": ruleType,
"target": target,
"isEnabled": isEnabled,
"claimValue": claimValue,
updatedRules = append(updatedRules, RoleManagementPolicyRule{
Id: pointer.To(id),
RuleType: rolemanagementpolicies.RoleManagementPolicyRuleType(ruleType),
Target: target,
IsEnabled: pointer.To(isEnabled),
ClaimValue: pointer.To(claimValue),
})
}
}
Expand Down Expand Up @@ -366,11 +366,11 @@ func buildRoleManagementPolicyForUpdate(metadata *sdk.ResourceMetaData, rolePoli
target = targetRaw.(map[string]interface{})
}

updatedRules = append(updatedRules, map[string]interface{}{
"id": id,
"ruleType": ruleType,
"target": target,
"enabledRules": enabledRules,
updatedRules = append(updatedRules, RoleManagementPolicyRule{
Id: pointer.To(id),
RuleType: rolemanagementpolicies.RoleManagementPolicyRuleType(ruleType),
Target: target,
EnabledRules: pointer.To(enabledRules),
})
}
}
Expand Down Expand Up @@ -595,15 +595,15 @@ func expandNotificationSettings(rule rolemanagementpolicies.RawRoleManagementPol
notificationType = notificationTypeRaw.(string)
}

return map[string]interface{}{
"id": id,
"ruleType": ruleType,
"target": target,
"recipientType": recipientType,
"notificationType": notificationType,
"notificationLevel": level,
"isDefaultRecipientsEnabled": defaultRecipients,
"notificationRecipients": additionalRecipients,
return RoleManagementPolicyRule{
Id: pointer.To(id),
RuleType: rolemanagementpolicies.RoleManagementPolicyRuleType(ruleType),
Target: target,
RecipientType: pointer.To(recipientType),
NotificationType: pointer.To(notificationType),
NotificationLevel: pointer.To(level),
IsDefaultRecipientsEnabled: pointer.To(defaultRecipients),
NotificationRecipients: pointer.To(additionalRecipients),
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package azurestackhci

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package azurestackhci_test

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package azurestackhci

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package azurestackhci_test

import (
Expand Down
3 changes: 3 additions & 0 deletions internal/services/azurestackhci/testdata/ad.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Follows https://learn.microsoft.com/en-us/azure-stack/hci/deploy/deployment-prep-active-directory
# The script is from https://github.com/Azure/Edge-infrastructure-quickstart-template/blob/c42d671bd8464071c3b8dfc9d599bef1631b22a2/modules/hci-provisioners/ad.ps1
param(
Expand Down
3 changes: 3 additions & 0 deletions internal/services/azurestackhci/testdata/connect.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# follows https://learn.microsoft.com/en-us/azure-stack/hci/deploy/deployment-arc-register-server-permissions?tabs=powershell
# the script is from https://github.com/Azure/Edge-infrastructure-quickstart-template/blob/c42d671bd8464071c3b8dfc9d599bef1631b22a2/modules/hci-provisioners/hci-server/connect.ps1
param(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ func dataSourceDataShareDatasetBlobStorageRead(d *pluginsdk.ResourceData, meta i
d.Set("data_share_id", shareId.ID())

if model := resp.Model; model != nil {
m := *model
if ds, ok := m.(dataset.BlobDataSet); ok {
if ds, ok := model.(dataset.BlobDataSet); ok {
props := ds.Properties
d.Set("container_name", props.ContainerName)
if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionId)); err != nil {
Expand All @@ -113,15 +112,15 @@ func dataSourceDataShareDatasetBlobStorageRead(d *pluginsdk.ResourceData, meta i
d.Set("file_path", props.FilePath)
d.Set("display_name", props.DataSetId)

} else if ds, ok := m.(dataset.BlobFolderDataSet); ok {
} else if ds, ok := model.(dataset.BlobFolderDataSet); ok {
props := ds.Properties
d.Set("container_name", props.ContainerName)
if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionId)); err != nil {
return fmt.Errorf("setting `storage_account`: %+v", err)
}
d.Set("folder_path", props.Prefix)
d.Set("display_name", props.DataSetId)
} else if ds, ok := m.(dataset.BlobContainerDataSet); ok {
} else if ds, ok := model.(dataset.BlobContainerDataSet); ok {
props := ds.Properties
d.Set("container_name", props.ContainerName)
if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionId)); err != nil {
Expand Down
Loading

0 comments on commit 795f4cb

Please sign in to comment.