Skip to content

Commit

Permalink
Merge branch 'main' of github.com:hashicorp/terraform-provider-azurer…
Browse files Browse the repository at this point in the history
…m into app_conf_replica
  • Loading branch information
teowa committed May 23, 2023
2 parents 334fe1b + de56e11 commit a6b644a
Show file tree
Hide file tree
Showing 222 changed files with 6,889 additions and 8,721 deletions.
2 changes: 1 addition & 1 deletion .release/provider-schema.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .teamcity/components/settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var serviceTestConfigurationOverrides = mapOf(
"mssql" to testConfiguration(locationOverride = LocationConfiguration("westeurope", "francecentral", "eastus2", false), useDevTestSubscription = true),

// MSSQL Managed Instance creation can impact the service so limit the frequency and number of tests
"mssqlmanagedinstance" to testConfiguration(parallelism = 5, daysOfWeek = "2,6", locationOverride = LocationConfiguration("westeurope", "francecentral", "eastus2", false), useDevTestSubscription = true),
"mssqlmanagedinstance" to testConfiguration(parallelism = 4, daysOfWeek = "7", locationOverride = LocationConfiguration("westeurope", "francecentral", "eastus2", false), useDevTestSubscription = true),

// MySQL has quota available in certain locations
"mysql" to testConfiguration(locationOverride = LocationConfiguration("westeurope", "francecentral", "eastus2", false), useDevTestSubscription = true),
Expand Down
33 changes: 26 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
## 3.57.0 (Unreleased)
## 3.58.0 (Unreleased)

ENHANCEMENTS:

* dependencies: updating to `v0.20230516.1215417` of `github.com/hashicorp/go-azure-sdk` [GH-21810]
* `nginx`: updating to use `hashicorp/go-azure-sdk` as a base layer rather than `Azure/go-autorest` [GH-21810]
* `portal`: updating to use `hashicorp/go-azure-sdk` as a base layer rather than `Azure/go-autorest` [GH-21810]
* `redis`: updating to use `hashicorp/go-azure-sdk` as a base layer rather than `Azure/go-autorest` [GH-21810]
* `redisenterprise`: updating to use `hashicorp/go-azure-sdk` as a base layer rather than `Azure/go-autorest` [GH-21810]

BUG FIXES:

* Data Source: `azurerm_kubernetes_cluster` - prevent a panic when some values returned are nil [GH-21867]
* `azurerm_application_insights_web_test` - normalizing the value for `application_insights_id` [GH-21837]

## 3.57.0 (May 19, 2023)

FEATURES:

* **New Data Source:** `azurerm_virtual_hub_connection` [GH-21681]
* **New Data Source:** `azurerm_virtual_hub_connection` ([#21681](https://github.com/hashicorp/terraform-provider-azurerm/issues/21681))

ENHANCEMENTS:

* `synapse`: refactoring to use `tombuildsstuff/kermit` rather than `Azure/azure-sdk-for-go` for Data Plane [GH-21792]
* `azurerm_batch_account` - support versionless keys for CMK [GH-21677]
* `azurerm_kubernetes_cluster` - changing the `http_proxy_config.no_proxy` no longer creates a new resource [GH-21793]
* `azurerm_media_transform` - support for the `jpg_image` and `png_image` blocks within the `custom_preset` block [GH-21709]
* `azurerm_recovery_services_vault` - support the `monitoring` block [GH-21691]
* `synapse`: refactoring to use `tombuildsstuff/kermit` rather than `Azure/azure-sdk-for-go` for Data Plane ([#21792](https://github.com/hashicorp/terraform-provider-azurerm/issues/21792))
* `azurerm_batch_account` - support versionless keys for CMK ([#21677](https://github.com/hashicorp/terraform-provider-azurerm/issues/21677))
* `azurerm_kubernetes_cluster` - changing the `http_proxy_config.no_proxy` no longer creates a new resource ([#21793](https://github.com/hashicorp/terraform-provider-azurerm/issues/21793))
* `azurerm_media_transform` - support for the `jpg_image` and `png_image` blocks within the `custom_preset` block ([#21709](https://github.com/hashicorp/terraform-provider-azurerm/issues/21709))
* `azurerm_recovery_services_vault` - support the `monitoring` block ([#21691](https://github.com/hashicorp/terraform-provider-azurerm/issues/21691))

BUG FIXES:

* `data.azurerm_kubernetes_cluster` - prevent a panic when some values returned are nil ([#21850](https://github.com/hashicorp/terraform-provider-azurerm/issues/21850))

## 3.56.0 (May 11, 2023)

Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/aci_connector_linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ resource "azurerm_kubernetes_cluster" "example" {
resource "azurerm_role_assignment" "example" {
scope = azurerm_subnet.example-aci.id
role_definition_name = "Network Contributor"
principal_id = azurerm_kubernetes_cluster.example.identity.0.principal_id
principal_id = azurerm_kubernetes_cluster.example.aci_connector_linux[0].connector_identity[0].object_id
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.1.2
github.com/hashicorp/go-azure-helpers v0.56.0
github.com/hashicorp/go-azure-sdk v0.20230511.1094507
github.com/hashicorp/go-azure-sdk v0.20230518.1140509
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/go-version v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv
github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg=
github.com/hashicorp/go-azure-helpers v0.56.0 h1:KxDXISHwWe4PKEz6FSSPG8vCXNrFGsCcCn/AI94ccig=
github.com/hashicorp/go-azure-helpers v0.56.0/go.mod h1:MbnCV9jPmlkbdH7VsoBK8IbCHvo3pLWRbRvq+F6u9sI=
github.com/hashicorp/go-azure-sdk v0.20230511.1094507 h1:uvmyrTZAHXtHzwkuHtjD889OyH3c4ul1IuPiegm/uag=
github.com/hashicorp/go-azure-sdk v0.20230511.1094507/go.mod h1:x2r7/U5MKlTHUO6/hFHRNO03qkRLBYyeQOuEUHkZmEg=
github.com/hashicorp/go-azure-sdk v0.20230518.1140509 h1:CFKJeqzCCRdP7MXf2PssV/spzK7RcOkQMrM6s1ijISo=
github.com/hashicorp/go-azure-sdk v0.20230518.1140509/go.mod h1:x2r7/U5MKlTHUO6/hFHRNO03qkRLBYyeQOuEUHkZmEg=
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
16 changes: 12 additions & 4 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,19 +410,27 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.Network, err = network.NewClient(o); err != nil {
return fmt.Errorf("building clients for Network: %+v", err)
}
client.Nginx = nginx.NewClient(o)
if client.Nginx, err = nginx.NewClient(o); err != nil {
return fmt.Errorf("building clients for Nginx: %+v", err)
}
client.NotificationHubs = notificationhub.NewClient(o)
client.Orbital = orbital.NewClient(o)
client.Policy = policy.NewClient(o)
client.Portal = portal.NewClient(o)
if client.Portal, err = portal.NewClient(o); err != nil {
return fmt.Errorf("building clients for Portal: %+v", err)
}
client.Postgres = postgres.NewClient(o)
client.PowerBI = powerBI.NewClient(o)
client.PrivateDns = privatedns.NewClient(o)
client.PrivateDnsResolver = dnsresolver.NewClient(o)
client.Purview = purview.NewClient(o)
client.RecoveryServices = recoveryServices.NewClient(o)
client.Redis = redis.NewClient(o)
client.RedisEnterprise = redisenterprise.NewClient(o)
if client.Redis, err = redis.NewClient(o); err != nil {
return fmt.Errorf("building clients for Redis: %+v", err)
}
if client.RedisEnterprise, err = redisenterprise.NewClient(o); err != nil {
return fmt.Errorf("building clients for RedisEnterprise: %+v", err)
}
client.Relay = relay.NewClient(o)
client.Resource = resource.NewClient(o)
if client.Search, err = search.NewClient(o); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/services/apimanagement/validate/api_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func ApiManagementApiName(v interface{}, k string) (ws []string, es []error) {
func ApiManagementApiPath(v interface{}, k string) (ws []string, es []error) {
value := v.(string)

if matched := regexp.MustCompile(`^(?:|[\w.][\w-/.]{0,398}[\w-])$`).Match([]byte(value)); !matched {
if matched := regexp.MustCompile(`^(?:|[\w.][\w-/.:]{0,398}[\w-])$`).Match([]byte(value)); !matched {
es = append(es, fmt.Errorf("%q may only be up to 400 characters in length, not start or end with `/` and only contain valid url characters", k))
}
return ws, es
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ func TestAzureRMApiManagementApiPath_validation(t *testing.T) {
Value: ".well-known",
ErrCount: 0,
},
{
Value: "api1:sub",
ErrCount: 0,
},
{
Value: s.Repeat("x", 401),
ErrCount: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ func resourceApplicationInsightsWebTestsRead(d *pluginsdk.ResourceData, meta int
appInsightsId = strings.Split(i, ":")[1]
}
}
d.Set("application_insights_id", appInsightsId)
parsedAppInsightsId, err := parse.ComponentIDInsensitively(appInsightsId)
if err != nil {
return fmt.Errorf("parsing `application_insights_id`: %+v", err)
}

d.Set("application_insights_id", parsedAppInsightsId.ID())
d.Set("name", id.Name)
d.Set("resource_group_name", id.ResourceGroup)
d.Set("kind", resp.Kind)
Expand Down
10 changes: 5 additions & 5 deletions internal/services/containers/kubernetes_cluster_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -886,27 +886,27 @@ func flattenKubernetesClusterDataSourceStorageProfile(input *managedclusters.Man

if input != nil {
blobEnabled := false
if input.BlobCSIDriver != nil {
if input.BlobCSIDriver != nil && input.BlobCSIDriver.Enabled != nil {
blobEnabled = *input.BlobCSIDriver.Enabled
}

diskEnabled := true
if input.DiskCSIDriver != nil {
if input.DiskCSIDriver != nil && input.DiskCSIDriver.Enabled != nil {
diskEnabled = *input.DiskCSIDriver.Enabled
}

diskVersion := ""
if input.FileCSIDriver != nil {
if input.DiskCSIDriver != nil && input.DiskCSIDriver.Version != nil {
diskVersion = *input.DiskCSIDriver.Version
}

fileEnabled := true
if input.DiskCSIDriver != nil {
if input.FileCSIDriver != nil && input.FileCSIDriver.Enabled != nil {
fileEnabled = *input.FileCSIDriver.Enabled
}

snapshotController := true
if input.SnapshotController != nil {
if input.SnapshotController != nil && input.SnapshotController.Enabled != nil {
snapshotController = *input.SnapshotController.Enabled
}

Expand Down
16 changes: 11 additions & 5 deletions internal/services/nginx/client/client.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
package client

import (
"github.com/Azure/go-autorest/autorest"
"fmt"

nginx "github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

func NewClient(o *common.ClientOptions) *nginx.Client {
client := nginx.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) {
c.Authorizer = o.ResourceManagerAuthorizer
func NewClient(o *common.ClientOptions) (*nginx.Client, error) {
client, err := nginx.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) {
c.Authorizer = o.Authorizers.ResourceManager
})
return &client
if err != nil {
return nil, fmt.Errorf("building clients for Nginx: %+v", err)
}

return client, nil
}
7 changes: 2 additions & 5 deletions internal/services/nginx/nginx_certificate_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,11 @@ func (m CertificateResource) Delete() sdk.ResourceFunc {

meta.Logger.Infof("deleting %s", id)
client := meta.Client.Nginx.NginxCertificate
future, err := client.CertificatesDelete(ctx, *id)
if err != nil {

if err := client.CertificatesDeleteThenPoll(ctx, *id); err != nil {
return fmt.Errorf("deleting %s: %v", id, err)
}

if err := future.Poller.PollUntilDone(); err != nil {
return fmt.Errorf("waiting for delete of %s: %v", id, err)
}
return nil
},
}
Expand Down
23 changes: 6 additions & 17 deletions internal/services/nginx/nginx_configuration_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,9 @@ func (m ConfigurationResource) Create() sdk.ResourceFunc {
}

req := model.ToSDKModel()
future, err := client.ConfigurationsCreateOrUpdate(ctx, id, req)
if err != nil {
return fmt.Errorf("creating %s: %v", id, err)
}

if err := future.Poller.PollUntilDone(); err != nil {
return fmt.Errorf("waiting for creation of %s: %v", id, err)
if err := client.ConfigurationsCreateOrUpdateThenPoll(ctx, id, req); err != nil {
return fmt.Errorf("creating %s: %v", id, err)
}

meta.SetID(id)
Expand Down Expand Up @@ -321,15 +317,10 @@ func (m ConfigurationResource) Update() sdk.ResourceFunc {
}
}

result, err := client.ConfigurationsCreateOrUpdate(ctx, *id, *upd)
if err != nil {
if err := client.ConfigurationsCreateOrUpdateThenPoll(ctx, *id, *upd); err != nil {
return fmt.Errorf("updating %s: %v", id, err)
}

if err := result.Poller.PollUntilDone(); err != nil {
return fmt.Errorf("waiting update %s: %v", *id, err)
}

return nil
},
}
Expand All @@ -346,13 +337,11 @@ func (m ConfigurationResource) Delete() sdk.ResourceFunc {

meta.Logger.Infof("deleting %s", id)
client := meta.Client.Nginx.NginxConfiguration
result, err := client.ConfigurationsDelete(ctx, *id)
if err != nil {

if err := client.ConfigurationsDeleteThenPoll(ctx, *id); err != nil {
return fmt.Errorf("deleting %s: %v", id, err)
}
if err := result.Poller.PollUntilDone(); err != nil {
return fmt.Errorf("waiting deleting %s: %v", *id, err)
}

return nil
},
}
Expand Down
17 changes: 6 additions & 11 deletions internal/services/nginx/nginx_deployment_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ func (m DeploymentResource) Update() sdk.ResourceFunc {
return sdk.ResourceFunc{
Timeout: time.Minute * 30,
Func: func(ctx context.Context, meta sdk.ResourceMetaData) error {
client := meta.Client.Nginx.NginxDeployment

id, err := nginxdeployment.ParseNginxDeploymentID(meta.ResourceData.Id())
if err != nil {
return err
Expand Down Expand Up @@ -429,14 +431,10 @@ func (m DeploymentResource) Update() sdk.ResourceFunc {
req.Properties.EnableDiagnosticsSupport = pointer.FromBool(model.DiagnoseSupportEnabled)
}

res, err := meta.Client.Nginx.NginxDeployment.DeploymentsUpdate(ctx, *id, req)
if err != nil {
if err := client.DeploymentsUpdateThenPoll(ctx, *id, req); err != nil {
return fmt.Errorf("updating %s: %v", id, err)
}

if err = res.Poller.PollUntilDone(); err != nil {
return fmt.Errorf("polling update %s: %v", id, err)
}
return nil
},
}
Expand All @@ -446,20 +444,17 @@ func (m DeploymentResource) Delete() sdk.ResourceFunc {
return sdk.ResourceFunc{
Timeout: 30 * time.Minute,
Func: func(ctx context.Context, meta sdk.ResourceMetaData) error {
client := meta.Client.Nginx.NginxDeployment
id, err := nginxdeployment.ParseNginxDeploymentID(meta.ResourceData.Id())
if err != nil {
return err
}
meta.Logger.Infof("deleting %s", id)

client := meta.Client.Nginx.NginxDeployment
result, err := client.DeploymentsDelete(ctx, *id)
if err != nil {
if err := client.DeploymentsDeleteThenPoll(ctx, *id); err != nil {
return fmt.Errorf("deleting %s: %v", id, err)
}
if err := result.Poller.PollUntilDone(); err != nil {
return fmt.Errorf("waiting delete %s: %v", id, err)
}

return nil
},
}
Expand Down
24 changes: 16 additions & 8 deletions internal/services/portal/client/client.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package client

import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard"
"github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
Expand All @@ -11,15 +13,21 @@ type Client struct {
TenantConfigurationsClient *tenantconfiguration.TenantConfigurationClient
}

func NewClient(o *common.ClientOptions) *Client {
dashboardsClient := dashboard.NewDashboardClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&dashboardsClient.Client, o.ResourceManagerAuthorizer)
func NewClient(o *common.ClientOptions) (*Client, error) {
dashboardsClient, err := dashboard.NewDashboardClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Dashboard client: %+v", err)
}
o.Configure(dashboardsClient.Client, o.Authorizers.ResourceManager)

tenantConfigurationsClient := tenantconfiguration.NewTenantConfigurationClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&tenantConfigurationsClient.Client, o.ResourceManagerAuthorizer)
tenantConfigurationsClient, err := tenantconfiguration.NewTenantConfigurationClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building TenantConfiguration client: %+v", err)
}
o.Configure(tenantConfigurationsClient.Client, o.Authorizers.ResourceManager)

return &Client{
DashboardsClient: &dashboardsClient,
TenantConfigurationsClient: &tenantConfigurationsClient,
}
DashboardsClient: dashboardsClient,
TenantConfigurationsClient: tenantConfigurationsClient,
}, nil
}
15 changes: 10 additions & 5 deletions internal/services/redis/client/client.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package client

import (
"github.com/Azure/go-autorest/autorest"
"fmt"

redis_2022_06_01 "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2022-06-01"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

func NewClient(o *common.ClientOptions) *redis_2022_06_01.Client {
client := redis_2022_06_01.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) {
c.Authorizer = o.ResourceManagerAuthorizer
func NewClient(o *common.ClientOptions) (*redis_2022_06_01.Client, error) {
client, err := redis_2022_06_01.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) {
c.Authorizer = o.Authorizers.ResourceManager
})
return &client
if err != nil {
return nil, fmt.Errorf("building clients for Redis: %+v", err)
}
return client, nil
}
Loading

0 comments on commit a6b644a

Please sign in to comment.