diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index 555b7373cca6..3beb1f2503b5 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -234,7 +234,7 @@ service/monitor: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_monitor_((.|\n)*)###' service/mssql: - - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(mssql_database\W+|mssql_database_extended_auditing_policy\W+|mssql_database_vulnerability_assessment_rule_baseline\W+|mssql_elasticpool\W+|mssql_failover_group\W+|mssql_firewall_rule\W+|mssql_job_agent\W+|mssql_job_credential\W+|mssql_outbound_firewall_rule\W+|mssql_server\W+|mssql_server_dns_alias\W+|mssql_server_extended_auditing_policy\W+|mssql_server_microsoft_support_auditing_policy\W+|mssql_server_security_alert_policy\W+|mssql_server_transparent_data_encryption\W+|mssql_server_vulnerability_assessment\W+|mssql_virtual_machine\W+|mssql_virtual_machine_availability_group_listener\W+|mssql_virtual_machine_group\W+|mssql_virtual_network_rule\W+)((.|\n)*)###' + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(mssql_database\W+|mssql_database_extended_auditing_policy\W+|mssql_database_vulnerability_assessment_rule_baseline\W+|mssql_elasticpool\W+|mssql_failover_group\W+|mssql_firewall_rule\W+|mssql_job\W+|mssql_job_agent\W+|mssql_job_credential\W+|mssql_job_schedule\W+|mssql_outbound_firewall_rule\W+|mssql_server\W+|mssql_server_dns_alias\W+|mssql_server_extended_auditing_policy\W+|mssql_server_microsoft_support_auditing_policy\W+|mssql_server_security_alert_policy\W+|mssql_server_transparent_data_encryption\W+|mssql_server_vulnerability_assessment\W+|mssql_virtual_machine\W+|mssql_virtual_machine_availability_group_listener\W+|mssql_virtual_machine_group\W+|mssql_virtual_network_rule\W+)((.|\n)*)###' service/mssqlmanagedinstance: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_mssql_managed_((.|\n)*)###' @@ -357,4 +357,4 @@ service/vmware: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(vmware_cluster\W+|vmware_express_route_authorization\W+|vmware_netapp_volume_attachment\W+|vmware_private_cloud\W+|voice_services_communications_gateway\W+|voice_services_communications_gateway_test_line\W+)((.|\n)*)###' service/workloads: - - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(chaos_studio_|container_connected_registry\W+|container_registry_cache_rule\W+|container_registry_cache_rule\W+|container_registry_task\W+|container_registry_task_schedule_run_now\W+|container_registry_token_password\W+|kubernetes_cluster_extension\W+|kubernetes_cluster_trusted_access_role_binding\W+|kubernetes_fleet_manager\W+|kubernetes_fleet_manager\W+|kubernetes_fleet_member\W+|kubernetes_fleet_update_run\W+|kubernetes_fleet_update_strategy\W+|kubernetes_flux_configuration\W+|kubernetes_node_pool_snapshot\W+|workloads_sap_)((.|\n)*)###' + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(chaos_studio_|container_connected_registry\W+|container_registry_cache_rule\W+|container_registry_cache_rule\W+|container_registry_credential_set\W+|container_registry_task\W+|container_registry_task_schedule_run_now\W+|container_registry_token_password\W+|kubernetes_cluster_extension\W+|kubernetes_cluster_trusted_access_role_binding\W+|kubernetes_fleet_manager\W+|kubernetes_fleet_manager\W+|kubernetes_fleet_member\W+|kubernetes_fleet_update_run\W+|kubernetes_fleet_update_strategy\W+|kubernetes_flux_configuration\W+|kubernetes_node_pool_snapshot\W+|workloads_sap_)((.|\n)*)###' diff --git a/contributing/topics/guide-new-data-source.md b/contributing/topics/guide-new-data-source.md index 120b3ae090bd..249d8f9848d4 100755 --- a/contributing/topics/guide-new-data-source.md +++ b/contributing/topics/guide-new-data-source.md @@ -148,7 +148,7 @@ func (ResourceGroupExampleDataSource) Attributes() map[string]*pluginsdk.Schema } func (ResourceGroupExampleDataSource) ModelObject() interface{} { - return &ResourceGroupExampleDataSourceModel + return &ResourceGroupExampleDataSourceModel{} } func (ResourceGroupExampleDataSource) ResourceType() string { @@ -160,6 +160,14 @@ func (ResourceGroupExampleDataSource) ResourceType() string { These functions define a Data Source called `azurerm_resource_group_example`, which has one Required argument called `name` and two Computed arguments called `location` and `tags`. +Schema fields should be ordered as follows: + +1. Any fields that make up the resource's ID, with the last user specified segment (usually the resource's name) first. (e.g. `name`, `resource_group_name`, or `name`, `parent_resource_id`) +2. The `location` field. +3. Required fields, sorted alphabetically. +4. Optional fields, sorted alphabetically. +5. Computed fields, sorted alphabetically. (Although in a typed data source these are always added within the `Attributes` method) + --- Next up, let's implement the Read function - which retrieves the information about the Resource Group from Azure: @@ -192,7 +200,7 @@ func (ResourceGroupExampleDataSource) Read() sdk.ResourceFunc { id := resources.NewResourceGroupExampleID(subscriptionId, state.Name) - // then retrieve the Resource Group by it's ID + // then retrieve the Resource Group by its ID resp, err := client.Get(ctx, id) if err != nil { // if the Resource Group doesn't exist (e.g. we get a 404 Not Found) diff --git a/contributing/topics/guide-new-fields-to-data-source.md b/contributing/topics/guide-new-fields-to-data-source.md index 6fd5efe19b6d..62a864e6d91e 100755 --- a/contributing/topics/guide-new-fields-to-data-source.md +++ b/contributing/topics/guide-new-fields-to-data-source.md @@ -16,7 +16,7 @@ The process is similar to [extending an existing Resource](guide-new-fields-to-r Building on the example from [adding a new data source](guide-new-data-source.md) the new property will need to be added into the `Attributes` list which contains a list of schema fields that are Computed only. -The location of the new property within this list is determined alphabetically. Taking the hypothetical property `public_network_access_enabled` as an example this would then end up looking like this in `Attributes`. +The location of the new property within this list is determined based on the order found in [adding a new data source](guide-new-data-source.md#step-3-scaffold-an-emptynew-data-source). Taking the hypothetical property `public_network_access_enabled` as an example this would then end up looking like this in `Attributes`. ```go func (ResourceGroupExampleDataSource) Attributes() map[string]*pluginsdk.Schema { diff --git a/contributing/topics/guide-new-fields-to-resource.md b/contributing/topics/guide-new-fields-to-resource.md index db565399b87e..04abac787739 100755 --- a/contributing/topics/guide-new-fields-to-resource.md +++ b/contributing/topics/guide-new-fields-to-resource.md @@ -14,7 +14,7 @@ Building on the example found in [adding a new resource](guide-new-resource.md) Our hypothetical property `public_network_access_enabled` will be user configurable and thus will need to be added to the `Arguments` list. -The position of the new property is determined alphabetically and will end up looking like the code block below. +The position of the new property is determined based on the order found in [adding a new resource](guide-new-resource.md#step-3-scaffold-an-emptynew-resource) and will end up looking like the code block below. ```go func (ResourceGroupExampleResource) Arguments() map[string]*pluginsdk.Schema { diff --git a/contributing/topics/guide-new-resource.md b/contributing/topics/guide-new-resource.md index c60f0967167e..8b1119a7d665 100755 --- a/contributing/topics/guide-new-resource.md +++ b/contributing/topics/guide-new-resource.md @@ -62,7 +62,7 @@ func NewClient(o *common.ClientOptions) (*Client, error) { return &Client{ GroupsClient: groupsClient, - } + }, nil } ``` @@ -166,6 +166,14 @@ func (ResourceGroupExampleResource) ResourceType() string { These functions define a Resource called `azurerm_resource_group_example`, which has two Required arguments (`name` and `location`) and one Optional argument (`tags`). We'll come back to `ModelObject` later. +Schema fields should be ordered as follows: + +1. Any fields that make up the resource's ID, with the last user specified segment (usually the resource's name) first. (e.g. `name` then `resource_group_name`, or `name` then `parent_resource_id`) +2. The `location` field. +3. Required fields, sorted alphabetically. +4. Optional fields, sorted alphabetically. +5. Computed fields, sorted alphabetically. (Although in a typed resource these are always added within the `Attributes` method) + --- Let's start by implementing the Create function: @@ -237,7 +245,7 @@ func (r ResourceGroupExampleResource) Update() sdk.ResourceFunc { client := metadata.Client.Resource.GroupsClient // parse the existing Resource ID from the State - id, err := resources.ParseResourceGroupID(metadata.ResourceData.Get("id").(string)) + id, err := resources.ParseResourceGroupID(metadata.ResourceData.Id()) if err != nil { return err } @@ -249,7 +257,7 @@ func (r ResourceGroupExampleResource) Update() sdk.ResourceFunc { // update the Resource Group // NOTE: for a more complex resource we'd recommend retrieving the existing Resource from the // API and then conditionally updating it when fields in the config have been updated, which - // can be determined by using `d.HasChanges` - for example: + // can be determined by using `metadata.ResourceData.HasChange` - for example: // // existing, err := client.Get(ctx, *id) // if err != nil { @@ -265,13 +273,13 @@ func (r ResourceGroupExampleResource) Update() sdk.ResourceFunc { // return fmt.Errorf("retrieving %s: `properties` was nil", id) // } // - // if d.HasChanges("tags") { - // existing.Model.Properties.Tags = tags.Expand(metadata.ResourceData.Get("tags").(map[string]interface{})) + // if metadata.ResourceData.HasChange("tags") { + // existing.Model.Properties.Tags = tags.Expand(config.Tags) // } // // doing so allows users to take advantage of Terraform's `ignore_changes` functionality. // - // However since a Resource Group only has one field which is updatable (tags) so in this case we'll only + // However since a Resource Group only has one field which is updatable (tags) we'll only // enter the update function if `tags` has been updated. param := resources.Group{ Location: pointer.To(location.Normalize(config.Location)), @@ -453,7 +461,7 @@ func (ResourceGroupExampleResource) Attributes() map[string]*pluginsdk.Schema { } func (ResourceGroupExampleResource) ModelObject() interface{} { - return &ResourceGroupExampleResourceModel + return &ResourceGroupExampleResourceModel{} } func (ResourceGroupExampleResource) ResourceType() string { @@ -501,7 +509,7 @@ func (r ResourceGroupExampleResource) Update() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.Resource.GroupsClient - id, err := resources.ParseResourceGroupID(metadata.ResourceData.Get("id").(string)) + id, err := resources.ParseResourceGroupID(metadata.ResourceData.Id()) if err != nil { return err } @@ -703,7 +711,7 @@ func TestAccResourceGroupExample_basic(t *testing.T) { { Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r) + check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), @@ -717,8 +725,11 @@ func TestAccResourceGroupExample_requiresImport(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - ExpectError: acceptance.RequiresImportError("azurerm_resource_group_example"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), }, + data.RequiresImportErrorStep(r.requiresImport), }) } @@ -730,7 +741,7 @@ func TestAccResourceGroupExample_complete(t *testing.T) { { Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r) + check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), diff --git a/contributing/topics/reference-acceptance-testing.md b/contributing/topics/reference-acceptance-testing.md index d36abf18fa76..8658887e9cc7 100755 --- a/contributing/topics/reference-acceptance-testing.md +++ b/contributing/topics/reference-acceptance-testing.md @@ -18,7 +18,7 @@ See [Running the Tests](running-the-tests.md). ### Test Package -While tests reside in the same folder as resource and data source .go files, they need to be in a separate test package to prevent circuler references. ie for the file `./internal/services/aab2c/aadb2c_directory_data_source_test.go` the package should be: +While tests reside in the same folder as resource and data source .go files, they need to be in a separate test package to prevent circular references. i.e. for the file `./internal/services/aab2c/aadb2c_directory_data_source_test.go` the package should be: ```go package aadb2c_test @@ -134,11 +134,12 @@ func TestAccExampleDataSource_complete(t *testing.T) { { Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).Key("example_property").HasValue("bar") - check.That(data.ResourceName).Key("example_optional_bool").HasValue("false") - check.That(data.ResourceName).Key("example_optional_string").HasValue("foo") + check.That(data.ResourceName).Key("example_property").HasValue("bar"), + check.That(data.ResourceName).Key("example_optional_bool").HasValue("false"), + check.That(data.ResourceName).Key("example_optional_string").HasValue("foo"), ), }, + data.ImportStep(), }) } diff --git a/contributing/topics/schema-design-considerations.md b/contributing/topics/schema-design-considerations.md index 3bbec16dd71d..7ec31f3e7099 100755 --- a/contributing/topics/schema-design-considerations.md +++ b/contributing/topics/schema-design-considerations.md @@ -36,7 +36,7 @@ In the cases where `Enabled` is the only field within the object we opt to flatt }, ``` -However when there are multiple fields in addtion to the `Enabled` one and they are all required for the object/feature like in Example B, a terraform block is created with all the fields including `Enabled`. The corresponding Terraform schema would be as follows: +However when there are multiple fields in addition to the `Enabled` field and they are all required for the object/feature like in Example B, a terraform block is created with all the fields including `Enabled`. The corresponding Terraform schema would be as follows: ```go "vertical_pod_autoscaler": { diff --git a/examples/app-service-certificate/stored-in-keyvault/main.tf b/examples/app-service-certificate/stored-in-keyvault/main.tf index 05ca21c1961f..c9ff8a643c83 100644 --- a/examples/app-service-certificate/stored-in-keyvault/main.tf +++ b/examples/app-service-certificate/stored-in-keyvault/main.tf @@ -34,7 +34,7 @@ resource "azurerm_key_vault_access_policy" "current_user" { } data "azuread_service_principal" "web_app_resource_provider" { - application_id = "abfa0a7c-a6b6-4736-8310-5855508787cd" + client_id = data.azurerm_client_config.current.client_id } resource "azurerm_key_vault_access_policy" "web_app_resource_provider" { diff --git a/examples/app-service/docker-authentication/main.tf b/examples/app-service/docker-authentication/main.tf index 87097fb67c33..715e764c90e0 100644 --- a/examples/app-service/docker-authentication/main.tf +++ b/examples/app-service/docker-authentication/main.tf @@ -32,8 +32,8 @@ resource "azurerm_linux_web_app" "example" { site_config { application_stack { - docker_image = "jackofallops/azure-containerapps-python-acctest" - docker_image_tag = "v0.0.1" + docker_image_name = "nginx:latest" + docker_registry_url = "https://index.docker.io" } } diff --git a/examples/azure-monitoring/eventhub_integration/main.tf b/examples/azure-monitoring/eventhub_integration/main.tf index 2c4de161a6e3..a6f36ea51a9c 100644 --- a/examples/azure-monitoring/eventhub_integration/main.tf +++ b/examples/azure-monitoring/eventhub_integration/main.tf @@ -48,27 +48,13 @@ resource "azurerm_monitor_diagnostic_setting" "example" { eventhub_name = azurerm_eventhub.example.name eventhub_authorization_rule_id = azurerm_eventhub_namespace_authorization_rule.example.id - dynamic "log" { - for_each = data.azurerm_monitor_diagnostic_categories.example.logs + dynamic "enabled_log" { + for_each = data.azurerm_monitor_diagnostic_categories.example.log_category_types content { - category = log.key - - retention_policy { - enabled = false - days = 0 - } + category = enabled_log.key } } - dynamic "metric" { - for_each = data.azurerm_monitor_diagnostic_categories.example.metrics - - content { - category = metric.key - - retention_policy { - enabled = false - days = 0 - } - } + metric { + category = "AllMetrics" } } diff --git a/examples/batch/custom-image/main.tf b/examples/batch/custom-image/main.tf index 7b9157b07efe..4f1374a24f58 100644 --- a/examples/batch/custom-image/main.tf +++ b/examples/batch/custom-image/main.tf @@ -107,11 +107,12 @@ resource "azurerm_image" "example" { resource_group_name = azurerm_resource_group.example.name os_disk { - os_type = "Linux" - os_state = "Generalized" - blob_uri = azurerm_virtual_machine.example.storage_os_disk.0.vhd_uri - size_gb = 30 - caching = "None" + os_type = "Linux" + os_state = "Generalized" + blob_uri = azurerm_virtual_machine.example.storage_os_disk.0.vhd_uri + size_gb = 30 + caching = "None" + storage_type = "Standard_LRS" } tags = { diff --git a/examples/cosmos-db/failover/main.tf b/examples/cosmos-db/failover/main.tf index 9aa3c1ecf0b1..859329799d94 100644 --- a/examples/cosmos-db/failover/main.tf +++ b/examples/cosmos-db/failover/main.tf @@ -21,7 +21,7 @@ resource "azurerm_cosmosdb_account" "example" { // set ip_range_filter to allow azure services (0.0.0.0) and azure portal. // https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-configure-firewall#allow-requests-from-the-azure-portal // https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-configure-firewall#allow-requests-from-global-azure-datacenters-or-other-sources-within-azure - ip_range_filter = "0.0.0.0,104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26" + ip_range_filter = ["0.0.0.0", "104.42.195.92", "40.76.54.131", "52.176.6.30", "52.169.50.45", "52.187.184.26"] consistency_policy { consistency_level = "BoundedStaleness" diff --git a/examples/hdinsight/enterprise-security-package/main.tf b/examples/hdinsight/enterprise-security-package/main.tf index df449e2d4970..6359eaf029bd 100644 --- a/examples/hdinsight/enterprise-security-package/main.tf +++ b/examples/hdinsight/enterprise-security-package/main.tf @@ -42,7 +42,7 @@ resource "azurerm_subnet" "example" { name = "${var.prefix}-subnet" resource_group_name = azurerm_resource_group.example.name virtual_network_name = azurerm_virtual_network.example.name - address_prefixes = [cidrsubnet(azurerm_virtual_network.example.address_space.0, 8, 0)] + address_prefixes = azurerm_virtual_network.example.address_space } resource "azurerm_network_security_group" "example" { diff --git a/examples/image/from_vhd/main.tf b/examples/image/from_vhd/main.tf index 245fb3c81678..2bbae5978c42 100644 --- a/examples/image/from_vhd/main.tf +++ b/examples/image/from_vhd/main.tf @@ -89,9 +89,10 @@ resource "azurerm_image" "example" { resource_group_name = azurerm_resource_group.example.name os_disk { - os_type = "Linux" - os_state = "Generalized" - blob_uri = azurerm_virtual_machine.example.storage_os_disk[0].vhd_uri - size_gb = 30 + os_type = "Linux" + os_state = "Generalized" + blob_uri = azurerm_virtual_machine.example.storage_os_disk[0].vhd_uri + size_gb = 30 + storage_type = "Standard_LRS" } } diff --git a/examples/kubernetes/egress-with-udr-azure-cni/main.tf b/examples/kubernetes/egress-with-udr-azure-cni/main.tf index d96a5f7524bc..c607e46b0e71 100644 --- a/examples/kubernetes/egress-with-udr-azure-cni/main.tf +++ b/examples/kubernetes/egress-with-udr-azure-cni/main.tf @@ -28,7 +28,7 @@ resource "azurerm_route_table" "example" { name = "${var.prefix}fwrt" location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name - disable_bgp_route_propagation = false + bgp_route_propagation_enabled = true route { name = "${var.prefix}fwrn" diff --git a/examples/kubernetes/egress-with-udr-kubenet/main.tf b/examples/kubernetes/egress-with-udr-kubenet/main.tf index a286f81562e7..19078f902ad8 100644 --- a/examples/kubernetes/egress-with-udr-kubenet/main.tf +++ b/examples/kubernetes/egress-with-udr-kubenet/main.tf @@ -28,7 +28,7 @@ resource "azurerm_route_table" "example" { name = "${var.prefix}fwrt" location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name - disable_bgp_route_propagation = false + bgp_route_propagation_enabled = true route { name = "${var.prefix}fwrn" diff --git a/examples/media-services/basic-with-assets/README.md b/examples/media-services/basic-with-assets/README.md deleted file mode 100644 index 4e37b3ae1313..000000000000 --- a/examples/media-services/basic-with-assets/README.md +++ /dev/null @@ -1,9 +0,0 @@ -## Example: Media Services - -This example provisions a Media Service with a single Storage Account and with a single Media Asset. - -### Variables - -* `prefix` - (Required) The prefix used for all resources in this example. - -* `location` - (Required) The Azure Region in which the resources in this example should be created. diff --git a/examples/media-services/basic-with-assets/main.tf b/examples/media-services/basic-with-assets/main.tf deleted file mode 100644 index f2ff9d5a71f2..000000000000 --- a/examples/media-services/basic-with-assets/main.tf +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: MPL-2.0 - -provider "azurerm" { - features {} -} - -resource "azurerm_resource_group" "example" { - name = "${var.prefix}-resources" - location = var.location -} - -resource "azurerm_storage_account" "example" { - name = "${var.prefix}storacc" - resource_group_name = azurerm_resource_group.example.name - location = azurerm_resource_group.example.location - account_tier = "Standard" - account_replication_type = "GRS" - - tags = { - environment = "staging" - } -} - -resource "azurerm_media_services_account" "example" { - name = "${var.prefix}mediasvc" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - - storage_account { - id = azurerm_storage_account.example.id - is_primary = true - } -} - -resource "azurerm_media_asset" "example" { - name = "Asset1" - description = "Asset description" - resource_group_name = azurerm_resource_group.example.name - media_services_account_name = azurerm_media_services_account.example.name -} - -output "rendered" { - value = azurerm_media_asset.example.id -} diff --git a/examples/media-services/basic-with-assets/variables.tf b/examples/media-services/basic-with-assets/variables.tf deleted file mode 100644 index 3d161bddd568..000000000000 --- a/examples/media-services/basic-with-assets/variables.tf +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: MPL-2.0 - -variable "prefix" { - description = "The Prefix used for all resources in this example." -} - -variable "location" { - description = "The Azure Region in which all resources in this example should be created." -} diff --git a/examples/media-services/basic/README.md b/examples/media-services/basic/README.md deleted file mode 100644 index be2a1dcda2b3..000000000000 --- a/examples/media-services/basic/README.md +++ /dev/null @@ -1,9 +0,0 @@ -## Example: Media Services - -This example provisions a Media Service with a single Storage Account. - -### Variables - -* `prefix` - (Required) The prefix used for all resources in this example. - -* `location` - (Required) The Azure Region in which the resources in this example should be created. diff --git a/examples/media-services/basic/main.tf b/examples/media-services/basic/main.tf deleted file mode 100644 index 19d0c249f0a1..000000000000 --- a/examples/media-services/basic/main.tf +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: MPL-2.0 - -provider "azurerm" { - features {} -} - -resource "azurerm_resource_group" "example" { - name = "${var.prefix}-resources" - location = var.location -} - -resource "azurerm_storage_account" "example" { - name = "${var.prefix}storacc" - resource_group_name = azurerm_resource_group.example.name - location = azurerm_resource_group.example.location - account_tier = "Standard" - account_replication_type = "GRS" - - tags = { - environment = "staging" - } -} - -resource "azurerm_media_services_account" "example" { - name = "${var.prefix}mediasvc" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - - storage_account { - id = azurerm_storage_account.example.id - is_primary = true - } -} - -output "rendered" { - value = azurerm_media_services_account.example.id -} diff --git a/examples/media-services/basic/variables.tf b/examples/media-services/basic/variables.tf deleted file mode 100644 index 839c05dff550..000000000000 --- a/examples/media-services/basic/variables.tf +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: MPL-2.0 - -variable "prefix" { - description = "The Prefix used for all resources in this example" -} - -variable "location" { - description = "The Azure Region in which all resources in this example should be created." -} diff --git a/examples/media-services/multiple-storage-accounts/README.md b/examples/media-services/multiple-storage-accounts/README.md deleted file mode 100644 index 947277237a61..000000000000 --- a/examples/media-services/multiple-storage-accounts/README.md +++ /dev/null @@ -1,9 +0,0 @@ -## Example: Media Services - -This example provisions a Media Service with multiple Storage Accounts. - -### Variables - -* `prefix` - (Required) The prefix used for all resources in this example. - -* `location` - (Required) The Azure Region in which the resources in this example should be created. diff --git a/examples/media-services/multiple-storage-accounts/main.tf b/examples/media-services/multiple-storage-accounts/main.tf deleted file mode 100644 index 0d9eb3a43ca9..000000000000 --- a/examples/media-services/multiple-storage-accounts/main.tf +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: MPL-2.0 - -provider "azurerm" { - features {} -} - -resource "azurerm_resource_group" "example" { - name = "${var.prefix}-resources" - location = var.location -} - -resource "azurerm_storage_account" "example" { - name = "${var.prefix}stor1" - resource_group_name = azurerm_resource_group.example.name - location = azurerm_resource_group.example.location - account_tier = "Standard" - account_replication_type = "GRS" -} - -resource "azurerm_storage_account" "example2" { - name = "${var.prefix}stor2" - resource_group_name = azurerm_resource_group.example.name - location = azurerm_resource_group.example.location - account_tier = "Standard" - account_replication_type = "GRS" - - tags = { - environment = "staging" - } -} - -resource "azurerm_media_services_account" "example" { - name = "${var.prefix}-mediasvc" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - - storage_account { - id = azurerm_storage_account.example.id - is_primary = true - } - - storage_account { - id = azurerm_storage_account.example2.id - is_primary = false - } -} - -output "rendered" { - value = azurerm_media_services_account.example.id -} diff --git a/examples/media-services/multiple-storage-accounts/variables.tf b/examples/media-services/multiple-storage-accounts/variables.tf deleted file mode 100644 index 839c05dff550..000000000000 --- a/examples/media-services/multiple-storage-accounts/variables.tf +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: MPL-2.0 - -variable "prefix" { - description = "The Prefix used for all resources in this example" -} - -variable "location" { - description = "The Azure Region in which all resources in this example should be created." -} diff --git a/examples/netapp/nfsv3_volume_with_backup_policy/main.tf b/examples/netapp/nfsv3_volume_with_backup_policy/main.tf index bff4aadd06f3..a8db38001743 100755 --- a/examples/netapp/nfsv3_volume_with_backup_policy/main.tf +++ b/examples/netapp/nfsv3_volume_with_backup_policy/main.tf @@ -4,7 +4,7 @@ provider "azurerm" { features { netapp { - prevent_volume_destruction = false + prevent_volume_destruction = false delete_backups_on_backup_vault_destroy = true } } @@ -59,7 +59,7 @@ resource "azurerm_netapp_backup_policy" "example" { daily_backups_to_keep = 2 weekly_backups_to_keep = 2 monthly_backups_to_keep = 2 - enabled = true + enabled = true } resource "azurerm_netapp_pool" "example" { @@ -95,9 +95,9 @@ resource "azurerm_netapp_volume" "example" { } export_policy_rule { - rule_index = 1 - allowed_clients = ["0.0.0.0/0"] + rule_index = 1 + allowed_clients = ["0.0.0.0/0"] protocols_enabled = ["NFSv3"] - unix_read_write = true + unix_read_write = true } } diff --git a/examples/paloalto/ngfw-virtual-network-rulestack/main.tf b/examples/paloalto/ngfw-virtual-network-rulestack/main.tf index bfd8d54aa156..75cbcdc0e538 100644 --- a/examples/paloalto/ngfw-virtual-network-rulestack/main.tf +++ b/examples/paloalto/ngfw-virtual-network-rulestack/main.tf @@ -100,6 +100,7 @@ resource "azurerm_palo_alto_local_rulestack_rule" "example" { rulestack_id = azurerm_palo_alto_local_rulestack.example.id priority = 9999 action = "DenySilent" + protocol = "application-default" applications = ["any"] diff --git a/examples/private-endpoint/application-gateway/main.tf b/examples/private-endpoint/application-gateway/main.tf index 338527251735..7a5d81d292c6 100644 --- a/examples/private-endpoint/application-gateway/main.tf +++ b/examples/private-endpoint/application-gateway/main.tf @@ -32,7 +32,7 @@ resource "azurerm_subnet" "endpoint" { virtual_network_name = azurerm_virtual_network.example.name address_prefixes = ["10.0.2.0/24"] - private_endpoint_network_policies_enabled = false + private_endpoint_network_policies = "Disabled" } resource "azurerm_public_ip" "example" { diff --git a/examples/private-endpoint/postgresql/main.tf b/examples/private-endpoint/postgresql/main.tf index d05d27dd56dc..9c8468a0bba3 100644 --- a/examples/private-endpoint/postgresql/main.tf +++ b/examples/private-endpoint/postgresql/main.tf @@ -23,7 +23,7 @@ resource "azurerm_subnet" "endpoint" { virtual_network_name = azurerm_virtual_network.example.name address_prefixes = ["10.0.2.0/24"] - private_endpoint_network_policies_enabled = false + private_endpoint_network_policies = "Disabled" } resource "azurerm_postgresql_server" "example" { diff --git a/examples/private-endpoint/private-dns-group/main.tf b/examples/private-endpoint/private-dns-group/main.tf index c4b59df7d0a3..5d2a187e0bae 100644 --- a/examples/private-endpoint/private-dns-group/main.tf +++ b/examples/private-endpoint/private-dns-group/main.tf @@ -23,7 +23,7 @@ resource "azurerm_subnet" "endpoint" { virtual_network_name = azurerm_virtual_network.example.name address_prefixes = ["10.0.2.0/24"] - private_endpoint_network_policies_enabled = false + private_endpoint_network_policies = "Disabled" } resource "azurerm_private_dns_zone" "example" { diff --git a/examples/private-endpoint/private-link-service/main.tf b/examples/private-endpoint/private-link-service/main.tf index 327cfb51d426..8efe79750f9c 100644 --- a/examples/private-endpoint/private-link-service/main.tf +++ b/examples/private-endpoint/private-link-service/main.tf @@ -25,7 +25,7 @@ resource "azurerm_subnet" "service" { virtual_network_name = azurerm_virtual_network.example.name address_prefixes = ["10.0.1.0/24"] - private_link_service_network_policies_enabled = false + private_endpoint_network_policies = "Disabled" } resource "azurerm_subnet" "endpoint" { @@ -34,7 +34,7 @@ resource "azurerm_subnet" "endpoint" { virtual_network_name = azurerm_virtual_network.example.name address_prefixes = ["10.0.2.0/24"] - private_endpoint_network_policies_enabled = false + private_endpoint_network_policies = "Disabled" } resource "azurerm_public_ip" "example" { diff --git a/examples/redis-cache/basic/main.tf b/examples/redis-cache/basic/main.tf index f50fe40a1369..dad8ccfcae6b 100644 --- a/examples/redis-cache/basic/main.tf +++ b/examples/redis-cache/basic/main.tf @@ -12,11 +12,11 @@ resource "azurerm_resource_group" "example" { # NOTE: the Name used for Redis needs to be globally unique resource "azurerm_redis_cache" "example" { - name = "${var.prefix}-redis" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - capacity = 0 - family = "C" - sku_name = "Basic" - enable_non_ssl_port = false + name = "${var.prefix}-redis" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + capacity = 0 + family = "C" + sku_name = "Basic" + non_ssl_port_enabled = false } diff --git a/examples/redis-cache/premium-with-backup/main.tf b/examples/redis-cache/premium-with-backup/main.tf index 03d99dc664c7..fc735d94e1f2 100644 --- a/examples/redis-cache/premium-with-backup/main.tf +++ b/examples/redis-cache/premium-with-backup/main.tf @@ -20,13 +20,13 @@ resource "azurerm_storage_account" "example" { # NOTE: the Name used for Redis needs to be globally unique resource "azurerm_redis_cache" "example" { - name = "${var.prefix}-cache" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - capacity = 3 - family = "P" - sku_name = "Premium" - enable_non_ssl_port = false + name = "${var.prefix}-cache" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + capacity = 3 + family = "P" + sku_name = "Premium" + non_ssl_port_enabled = false redis_configuration { rdb_backup_enabled = true diff --git a/examples/redis-cache/premium-with-clustering/main.tf b/examples/redis-cache/premium-with-clustering/main.tf index 4ab761496fee..0b8604c1b7af 100644 --- a/examples/redis-cache/premium-with-clustering/main.tf +++ b/examples/redis-cache/premium-with-clustering/main.tf @@ -12,14 +12,14 @@ resource "azurerm_resource_group" "example" { # NOTE: the Name used for Redis needs to be globally unique resource "azurerm_redis_cache" "example" { - name = "${var.prefix}-cache" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - capacity = 1 - family = "P" - sku_name = "Premium" - enable_non_ssl_port = false - shard_count = 3 + name = "${var.prefix}-cache" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + capacity = 1 + family = "P" + sku_name = "Premium" + non_ssl_port_enabled = false + shard_count = 3 redis_configuration { maxmemory_reserved = 2 diff --git a/examples/redis-cache/standard/main.tf b/examples/redis-cache/standard/main.tf index 42553fdb1d79..b662fc688a01 100644 --- a/examples/redis-cache/standard/main.tf +++ b/examples/redis-cache/standard/main.tf @@ -12,14 +12,14 @@ resource "azurerm_resource_group" "example" { # NOTE: the Name used for Redis needs to be globally unique resource "azurerm_redis_cache" "example" { - name = "${var.prefix}-cache" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - capacity = 2 - family = "C" - sku_name = "Standard" - enable_non_ssl_port = false - minimum_tls_version = "1.2" + name = "${var.prefix}-cache" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + capacity = 2 + family = "C" + sku_name = "Standard" + non_ssl_port_enabled = false + minimum_tls_version = "1.2" redis_configuration {} } diff --git a/examples/servicebus/basic/main.tf b/examples/servicebus/basic/main.tf index df431de58de8..bd46f7445154 100644 --- a/examples/servicebus/basic/main.tf +++ b/examples/servicebus/basic/main.tf @@ -26,9 +26,9 @@ resource "azurerm_servicebus_namespace_authorization_rule" "example" { } resource "azurerm_servicebus_topic" "example" { - name = "${var.prefix}-sbtopic" - namespace_id = azurerm_servicebus_namespace.example.id - enable_partitioning = true + name = "${var.prefix}-sbtopic" + namespace_id = azurerm_servicebus_namespace.example.id + partitioning_enabled = true } resource "azurerm_servicebus_subscription" "example" { @@ -38,7 +38,7 @@ resource "azurerm_servicebus_subscription" "example" { } resource "azurerm_servicebus_queue" "example" { - name = "${var.prefix}-sbqueue" - namespace_id = azurerm_servicebus_namespace.example.id - enable_partitioning = true + name = "${var.prefix}-sbqueue" + namespace_id = azurerm_servicebus_namespace.example.id + partitioning_enabled = true } diff --git a/examples/servicebus/forwarding/main.tf b/examples/servicebus/forwarding/main.tf index faefd8502a4e..6f563b9a0d29 100644 --- a/examples/servicebus/forwarding/main.tf +++ b/examples/servicebus/forwarding/main.tf @@ -26,9 +26,9 @@ resource "azurerm_servicebus_namespace_authorization_rule" "example" { } resource "azurerm_servicebus_topic" "source" { - name = "${var.prefix}-sbt-source" - namespace_id = azurerm_servicebus_namespace.example.id - enable_partitioning = true + name = "${var.prefix}-sbt-source" + namespace_id = azurerm_servicebus_namespace.example.id + partitioning_enabled = true } resource "azurerm_servicebus_topic_authorization_rule" "example" { @@ -40,9 +40,9 @@ resource "azurerm_servicebus_topic_authorization_rule" "example" { } resource "azurerm_servicebus_topic" "destination" { - name = "${var.prefix}-sbt-destination" - namespace_id = azurerm_servicebus_namespace.example.id - enable_partitioning = true + name = "${var.prefix}-sbt-destination" + namespace_id = azurerm_servicebus_namespace.example.id + partitioning_enabled = true } resource "azurerm_servicebus_subscription" "example" { diff --git a/examples/sql-azure/database/main.tf b/examples/sql-azure/database/main.tf index 575e43d523b6..219fef4f4083 100644 --- a/examples/sql-azure/database/main.tf +++ b/examples/sql-azure/database/main.tf @@ -10,7 +10,7 @@ resource "azurerm_resource_group" "example" { location = var.location } -resource "azurerm_sql_server" "example" { +resource "azurerm_mssql_server" "example" { name = "${var.prefix}-sqlsvr" resource_group_name = azurerm_resource_group.example.name location = azurerm_resource_group.example.location @@ -19,23 +19,18 @@ resource "azurerm_sql_server" "example" { administrator_login_password = "4-v3ry-53cr37-p455w0rd" } -resource "azurerm_sql_database" "example" { - name = "${var.prefix}-db" - resource_group_name = azurerm_resource_group.example.name - location = azurerm_resource_group.example.location - server_name = azurerm_sql_server.example.name - edition = "Basic" - collation = "SQL_Latin1_General_CP1_CI_AS" - create_mode = "Default" - requested_service_objective_name = "Basic" +resource "azurerm_mssql_database" "example" { + name = "${var.prefix}-db" + server_id = azurerm_mssql_server.example.id + collation = "SQL_Latin1_General_CP1_CI_AS" + create_mode = "Default" } # Enables the "Allow Access to Azure services" box as described in the API docs # https://docs.microsoft.com/en-us/rest/api/sql/firewallrules/createorupdate -resource "azurerm_sql_firewall_rule" "example" { - name = "allow-azure-services" - resource_group_name = azurerm_resource_group.example.name - server_name = azurerm_sql_server.example.name - start_ip_address = "0.0.0.0" - end_ip_address = "0.0.0.0" +resource "azurerm_mssql_firewall_rule" "example" { + name = "allow-azure-services" + server_id = azurerm_mssql_server.example.id + start_ip_address = "0.0.0.0" + end_ip_address = "0.0.0.0" } diff --git a/examples/sql-azure/database/outputs.tf b/examples/sql-azure/database/outputs.tf index bc05fdfaff29..82ce6f543034 100644 --- a/examples/sql-azure/database/outputs.tf +++ b/examples/sql-azure/database/outputs.tf @@ -2,9 +2,9 @@ # SPDX-License-Identifier: MPL-2.0 output "sql_server_fqdn" { - value = azurerm_sql_server.example.fully_qualified_domain_name + value = azurerm_mssql_server.example.fully_qualified_domain_name } output "database_name" { - value = azurerm_sql_database.example.name + value = azurerm_mssql_database.example.name } diff --git a/examples/sql-azure/failover_group/main.tf b/examples/sql-azure/failover_group/main.tf index fa7067f707ca..b82b9ee079e7 100644 --- a/examples/sql-azure/failover_group/main.tf +++ b/examples/sql-azure/failover_group/main.tf @@ -43,13 +43,12 @@ resource "azurerm_mssql_database" "secondary" { creation_source_database_id = azurerm_mssql_database.example.id } -resource "azurerm_sql_failover_group" "example" { - name = "${var.prefix}-failover-group" - resource_group_name = azurerm_resource_group.example.name - server_name = azurerm_mssql_server.example.name - databases = [azurerm_mssql_database.example.id] +resource "azurerm_mssql_failover_group" "example" { + name = "${var.prefix}-failover-group" + server_id = azurerm_mssql_server.example.id + databases = [azurerm_mssql_database.example.id] - partner_servers { + partner_server { id = azurerm_mssql_server.secondary.id } diff --git a/examples/sql-azure/managed_instance_failover_group/main.tf b/examples/sql-azure/managed_instance_failover_group/main.tf index b9794a0dd63b..deaf4df2b9cb 100644 --- a/examples/sql-azure/managed_instance_failover_group/main.tf +++ b/examples/sql-azure/managed_instance_failover_group/main.tf @@ -64,11 +64,10 @@ module "vnet_gateway" { gateway_subnet_range_2 = "10.0.2.0/24" } -resource "azurerm_sql_managed_instance_failover_group" "example" { +resource "azurerm_mssql_managed_instance_failover_group" "example" { name = "${var.prefix}-fog" - resource_group_name = azurerm_resource_group.primary.name location = azurerm_resource_group.primary.location - managed_instance_name = module.primary.managed_instance_name + managed_instance_id = module.primary.managed_instance_id partner_managed_instance_id = module.secondary.managed_instance_id read_write_endpoint_failover_policy { @@ -78,6 +77,7 @@ resource "azurerm_sql_managed_instance_failover_group" "example" { depends_on = [ module.vnet_gateway ] + } diff --git a/examples/sql-azure/managed_instance_failover_group/modules/sql_managed_instance/main.tf b/examples/sql-azure/managed_instance_failover_group/modules/sql_managed_instance/main.tf index 3884efde5eb3..8942569396ee 100644 --- a/examples/sql-azure/managed_instance_failover_group/modules/sql_managed_instance/main.tf +++ b/examples/sql-azure/managed_instance_failover_group/modules/sql_managed_instance/main.tf @@ -207,7 +207,7 @@ resource "azurerm_route_table" "rt" { name = "${var.prefix}-mi-rt" location = var.location resource_group_name = var.resource_group_name - disable_bgp_route_propagation = false + bgp_route_propagation_enabled = true route { name = "subnet-to-vnetlocal" @@ -1190,7 +1190,7 @@ resource "azurerm_subnet_route_table_association" "subnet_rt" { route_table_id = azurerm_route_table.rt.id } -resource "azurerm_sql_managed_instance" "mi" { +resource "azurerm_mssql_managed_instance" "mi" { name = "${var.prefix}-mi" resource_group_name = var.resource_group_name location = var.location diff --git a/examples/sql-azure/managed_instance_failover_group/modules/sql_managed_instance/output.tf b/examples/sql-azure/managed_instance_failover_group/modules/sql_managed_instance/output.tf index ff8e630aff7a..c6e359a2bd7f 100644 --- a/examples/sql-azure/managed_instance_failover_group/modules/sql_managed_instance/output.tf +++ b/examples/sql-azure/managed_instance_failover_group/modules/sql_managed_instance/output.tf @@ -2,11 +2,11 @@ # SPDX-License-Identifier: MPL-2.0 output "managed_instance_id" { - value = azurerm_sql_managed_instance.mi.id + value = azurerm_mssql_managed_instance.mi.id } output "managed_instance_name" { - value = azurerm_sql_managed_instance.mi.name + value = azurerm_mssql_managed_instance.mi.name } output "vnet_name" { diff --git a/examples/sql-azure/sql_auditing_eventhub/main.tf b/examples/sql-azure/sql_auditing_eventhub/main.tf index 570629530737..8778427f11ee 100644 --- a/examples/sql-azure/sql_auditing_eventhub/main.tf +++ b/examples/sql-azure/sql_auditing_eventhub/main.tf @@ -54,25 +54,16 @@ resource "azurerm_monitor_diagnostic_setting" "example" { eventhub_authorization_rule_id = azurerm_eventhub_namespace_authorization_rule.example.id eventhub_name = azurerm_eventhub.example.name - log { + enabled_log { category = "SQLSecurityAuditEvents" - enabled = true - - retention_policy { - enabled = false - } } metric { category = "AllMetrics" - - retention_policy { - enabled = false - } } lifecycle { - ignore_changes = [log, metric] + ignore_changes = [metric] } } diff --git a/examples/storage/storage-container/main.tf b/examples/storage/storage-container/main.tf index 16ff4ff6cbf4..41f5f3370476 100644 --- a/examples/storage/storage-container/main.tf +++ b/examples/storage/storage-container/main.tf @@ -18,7 +18,7 @@ resource "azurerm_storage_account" "example" { account_tier = "Standard" account_kind = "StorageV2" account_replication_type = "LRS" - enable_https_traffic_only = true + https_traffic_only_enabled = true access_tier = "Hot" allow_nested_items_to_be_public = true } @@ -37,7 +37,7 @@ resource "azurerm_storage_account" "example2" { account_tier = "Standard" account_kind = "StorageV2" account_replication_type = "LRS" - enable_https_traffic_only = true + https_traffic_only_enabled = true access_tier = "Hot" allow_nested_items_to_be_public = true } diff --git a/examples/virtual-networks/azure-firewall/main.tf b/examples/virtual-networks/azure-firewall/main.tf index 62d80c44e7a9..a0707c37dde5 100644 --- a/examples/virtual-networks/azure-firewall/main.tf +++ b/examples/virtual-networks/azure-firewall/main.tf @@ -39,7 +39,7 @@ resource "azurerm_route_table" "azurt" { name = "AzfwRouteTable" resource_group_name = azurerm_resource_group.azurg.name location = azurerm_resource_group.azurg.location - disable_bgp_route_propagation = false + bgp_route_propagation_enabled = true route { name = "AzfwDefaultRoute" diff --git a/examples/virtual-networks/virtual-network-peering/main.tf b/examples/virtual-networks/virtual-network-peering/main.tf index 97f28b9f2054..a2598eab6083 100644 --- a/examples/virtual-networks/virtual-network-peering/main.tf +++ b/examples/virtual-networks/virtual-network-peering/main.tf @@ -17,8 +17,8 @@ resource "azurerm_virtual_network" "first" { address_space = ["10.0.0.0/24"] subnet { - name = "subnet1" - address_prefix = "10.0.0.0/24" + name = "subnet1" + address_prefixes = ["10.0.0.0/24"] } } @@ -29,8 +29,8 @@ resource "azurerm_virtual_network" "second" { address_space = ["192.168.0.0/24"] subnet { - name = "subnet1" - address_prefix = "192.168.0.0/24" + name = "subnet1" + address_prefixes = ["192.168.0.0/24"] } } diff --git a/go.mod b/go.mod index 399e182ed257..f25a1069d6ee 100644 --- a/go.mod +++ b/go.mod @@ -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.71.0 - github.com/hashicorp/go-azure-sdk/resource-manager v0.20241212.1154051 - github.com/hashicorp/go-azure-sdk/sdk v0.20241212.1154051 + github.com/hashicorp/go-azure-sdk/resource-manager v0.20250115.1141151 + github.com/hashicorp/go-azure-sdk/sdk v0.20250115.1141151 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 diff --git a/go.sum b/go.sum index 0903929d8112..17bcbc242ee9 100644 --- a/go.sum +++ b/go.sum @@ -94,10 +94,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.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.20241212.1154051 h1:jFgd3bzeRViGTzicIn9gDw2O/Gk6WjVJCTTefPNOGPY= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20241212.1154051/go.mod h1:XapOZ9HiCtXz3qb5yNFiCuWbOBj2I3WU1K2jwqgK2zA= -github.com/hashicorp/go-azure-sdk/sdk v0.20241212.1154051 h1:4fCKJPSeLVvwl7ZCqU7MOUKyx/M7kl/J6wlw2O3xn40= -github.com/hashicorp/go-azure-sdk/sdk v0.20241212.1154051/go.mod h1:oI5R0fTbBx3K/sJBK5R/OlEy8ozdQjvctxVU9v3EDkc= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20250115.1141151 h1:bPvF5BpQiyd6lAcS+YEcYZOPPsszEV2ElwtrlxjF6aM= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20250115.1141151/go.mod h1:h5yWlutmMw0h3tvfQ8hFoI37CT51ybYfqDfIFFiI1tg= +github.com/hashicorp/go-azure-sdk/sdk v0.20250115.1141151 h1:1Z1Y7QIHf1J9rzJTrRtgOhQYldhF1bOqny4uYn8aj/A= +github.com/hashicorp/go-azure-sdk/sdk v0.20250115.1141151/go.mod h1:oI5R0fTbBx3K/sJBK5R/OlEy8ozdQjvctxVU9v3EDkc= 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= diff --git a/internal/acceptance/data.go b/internal/acceptance/data.go index 0c5ca55ffcdb..223572dae775 100644 --- a/internal/acceptance/data.go +++ b/internal/acceptance/data.go @@ -82,7 +82,7 @@ func BuildTestData(t *testing.T, resourceType string, resourceLabel string) Test testData.Subscriptions = Subscriptions{ Primary: os.Getenv("ARM_SUBSCRIPTION_ID"), - Secondary: os.Getenv("ARM_TEST_SUBSCRIPTION_ID_ALT"), + Secondary: os.Getenv("ARM_SUBSCRIPTION_ID_ALT"), } return testData diff --git a/internal/sdk/resource_helpers_test.go b/internal/sdk/resource_helpers_test.go index 2c08f027f280..b458fd67951f 100644 --- a/internal/sdk/resource_helpers_test.go +++ b/internal/sdk/resource_helpers_test.go @@ -132,8 +132,7 @@ func TestParseStructTags_WithValue(t *testing.T) { if actual == nil { t.Fatalf("expected actual to have a value but got nil") - } - if !reflect.DeepEqual(*data.expected, *actual) { + } else if !reflect.DeepEqual(*data.expected, *actual) { t.Fatalf("expected [%+v] and actual [%+v] didn't match", *data.expected, *actual) } } diff --git a/internal/services/appservice/helpers/function_app_schema.go b/internal/services/appservice/helpers/function_app_schema.go index d99d6e9160ce..83aebea14f2d 100644 --- a/internal/services/appservice/helpers/function_app_schema.go +++ b/internal/services/appservice/helpers/function_app_schema.go @@ -11,7 +11,6 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-sdk/resource-manager/web/2023-12-01/webapps" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" apimValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -276,29 +275,18 @@ func SiteConfigSchemaLinuxFunctionApp() *pluginsdk.Schema { }, "health_check_path": { - Type: pluginsdk.TypeString, - Optional: true, - Description: "The path to be checked for this function app health.", - RequiredWith: func() []string { - if features.FourPointOhBeta() { - return []string{"site_config.0.health_check_eviction_time_in_min"} - } - return []string{} - }(), + Type: pluginsdk.TypeString, + Optional: true, + Description: "The path to be checked for this function app health.", + RequiredWith: []string{"site_config.0.health_check_eviction_time_in_min"}, }, "health_check_eviction_time_in_min": { // NOTE: Will evict the only node in single node configurations. Type: pluginsdk.TypeInt, Optional: true, - Computed: !features.FourPointOhBeta(), ValidateFunc: validation.IntBetween(2, 10), - RequiredWith: func() []string { - if features.FourPointOhBeta() { - return []string{"site_config.0.health_check_path"} - } - return []string{} - }(), - Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Only valid in conjunction with `health_check_path`", + RequiredWith: []string{"site_config.0.health_check_path"}, + Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Only valid in conjunction with `health_check_path`", }, "worker_count": { @@ -774,29 +762,18 @@ func SiteConfigSchemaWindowsFunctionApp() *pluginsdk.Schema { }, "health_check_path": { - Type: pluginsdk.TypeString, - Optional: true, - Description: "The path to be checked for this function app health.", - RequiredWith: func() []string { - if features.FourPointOhBeta() { - return []string{"site_config.0.health_check_eviction_time_in_min"} - } - return []string{} - }(), + Type: pluginsdk.TypeString, + Optional: true, + Description: "The path to be checked for this function app health.", + RequiredWith: []string{"site_config.0.health_check_eviction_time_in_min"}, }, "health_check_eviction_time_in_min": { // NOTE: Will evict the only node in single node configurations. Type: pluginsdk.TypeInt, Optional: true, - Computed: !features.FourPointOhBeta(), ValidateFunc: validation.IntBetween(2, 10), - RequiredWith: func() []string { - if features.FourPointOhBeta() { - return []string{"site_config.0.health_check_path"} - } - return []string{} - }(), - Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Only valid in conjunction with `health_check_path`", + RequiredWith: []string{"site_config.0.health_check_path"}, + Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Only valid in conjunction with `health_check_path`", }, "worker_count": { @@ -1132,6 +1109,7 @@ func linuxFunctionAppStackSchema() *pluginsdk.Schema { "16", "18", "20", + "22", }, false), ExactlyOneOf: []string{ "site_config.0.application_stack.0.dotnet_version", diff --git a/internal/services/appservice/helpers/fx_strings.go b/internal/services/appservice/helpers/fx_strings.go index 02468f12e540..ef099850b657 100644 --- a/internal/services/appservice/helpers/fx_strings.go +++ b/internal/services/appservice/helpers/fx_strings.go @@ -277,7 +277,7 @@ func JavaLinuxFxStringBuilder(javaMajorVersion, javaServer, javaServerVersion st case LinuxJavaServerTomcat: return pointer.To(fmt.Sprintf("%s|%s-java17", LinuxJavaServerTomcat, javaServerVersion)), nil // e,g, TOMCAT|10.0-java17 / TOMCAT|10.0.20-java17 case LinuxJavaServerJboss: - return nil, fmt.Errorf("java 17 is not supported on %s", LinuxJavaServerJboss) + return pointer.To(fmt.Sprintf("%s|%s-java17", LinuxJavaServerJboss, javaServerVersion)), nil // e.g. TOMCAT|10.0-java17 and TOMCAT|10.0.20-java17// e.g. JBOSSEAP|7-java17 / JBOSSEAP|7.4.2-java17 default: return pointer.To(fmt.Sprintf("%s|%s-java17", javaServer, javaServerVersion)), nil } diff --git a/internal/services/appservice/helpers/linux_web_app_schema.go b/internal/services/appservice/helpers/linux_web_app_schema.go index ca635f77bc5b..6d5301246800 100644 --- a/internal/services/appservice/helpers/linux_web_app_schema.go +++ b/internal/services/appservice/helpers/linux_web_app_schema.go @@ -216,28 +216,17 @@ func SiteConfigSchemaLinux() *pluginsdk.Schema { }, "health_check_path": { - Type: pluginsdk.TypeString, - Optional: true, - RequiredWith: func() []string { - if features.FourPointOhBeta() { - return []string{"site_config.0.health_check_eviction_time_in_min"} - } - return []string{} - }(), + Type: pluginsdk.TypeString, + Optional: true, + RequiredWith: []string{"site_config.0.health_check_eviction_time_in_min"}, }, "health_check_eviction_time_in_min": { Type: pluginsdk.TypeInt, Optional: true, - Computed: !features.FourPointOhBeta(), ValidateFunc: validation.IntBetween(2, 10), - RequiredWith: func() []string { - if features.FourPointOhBeta() { - return []string{"site_config.0.health_check_path"} - } - return []string{} - }(), - Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Only valid in conjunction with `health_check_path`", + RequiredWith: []string{"site_config.0.health_check_path"}, + Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Only valid in conjunction with `health_check_path`", }, "worker_count": { diff --git a/internal/services/appservice/helpers/web_app_slot_schema.go b/internal/services/appservice/helpers/web_app_slot_schema.go index 34a024601fab..cbc350337f59 100644 --- a/internal/services/appservice/helpers/web_app_slot_schema.go +++ b/internal/services/appservice/helpers/web_app_slot_schema.go @@ -203,28 +203,17 @@ func SiteConfigSchemaLinuxWebAppSlot() *pluginsdk.Schema { }, "health_check_path": { - Type: pluginsdk.TypeString, - Optional: true, - RequiredWith: func() []string { - if features.FourPointOhBeta() { - return []string{"site_config.0.health_check_eviction_time_in_min"} - } - return []string{} - }(), + Type: pluginsdk.TypeString, + Optional: true, + RequiredWith: []string{"site_config.0.health_check_eviction_time_in_min"}, }, "health_check_eviction_time_in_min": { Type: pluginsdk.TypeInt, Optional: true, - Computed: !features.FourPointOhBeta(), ValidateFunc: validation.IntBetween(2, 10), - RequiredWith: func() []string { - if features.FourPointOhBeta() { - return []string{"site_config.0.health_check_path"} - } - return []string{} - }(), - Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Only valid in conjunction with `health_check_path`", + RequiredWith: []string{"site_config.0.health_check_path"}, + Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Only valid in conjunction with `health_check_path`", }, "worker_count": { @@ -469,28 +458,17 @@ func SiteConfigSchemaWindowsWebAppSlot() *pluginsdk.Schema { }, "health_check_path": { - Type: pluginsdk.TypeString, - Optional: true, - RequiredWith: func() []string { - if features.FourPointOhBeta() { - return []string{"site_config.0.health_check_eviction_time_in_min"} - } - return []string{} - }(), + Type: pluginsdk.TypeString, + Optional: true, + RequiredWith: []string{"site_config.0.health_check_eviction_time_in_min"}, }, "health_check_eviction_time_in_min": { Type: pluginsdk.TypeInt, Optional: true, - Computed: !features.FourPointOhBeta(), ValidateFunc: validation.IntBetween(2, 10), - RequiredWith: func() []string { - if features.FourPointOhBeta() { - return []string{"site_config.0.health_check_path"} - } - return []string{} - }(), - Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Only valid in conjunction with `health_check_path`", + RequiredWith: []string{"site_config.0.health_check_path"}, + Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Only valid in conjunction with `health_check_path`", }, "worker_count": { diff --git a/internal/services/appservice/helpers/windows_web_app_schema.go b/internal/services/appservice/helpers/windows_web_app_schema.go index a3122e6f7aac..2a8ae81d0c7f 100644 --- a/internal/services/appservice/helpers/windows_web_app_schema.go +++ b/internal/services/appservice/helpers/windows_web_app_schema.go @@ -220,14 +220,9 @@ func SiteConfigSchemaWindows() *pluginsdk.Schema { }, "health_check_path": { - Type: pluginsdk.TypeString, - Optional: true, - RequiredWith: func() []string { - if features.FourPointOhBeta() { - return []string{"site_config.0.health_check_eviction_time_in_min"} - } - return []string{} - }(), + Type: pluginsdk.TypeString, + Optional: true, + RequiredWith: []string{"site_config.0.health_check_eviction_time_in_min"}, }, "health_check_eviction_time_in_min": { diff --git a/internal/services/appservice/linux_function_app_resource_test.go b/internal/services/appservice/linux_function_app_resource_test.go index b118a8f69522..ff5f35dd3723 100644 --- a/internal/services/appservice/linux_function_app_resource_test.go +++ b/internal/services/appservice/linux_function_app_resource_test.go @@ -16,7 +16,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -606,9 +605,6 @@ func TestAccLinuxFunctionApp_consumptionCompleteUpdate(t *testing.T) { } func TestAccLinuxFunctionApp_elasticPremiumCompleteWithVnetProperties(t *testing.T) { - if !features.FourPointOhBeta() { - t.Skip("this test requires 4.0 mode") - } data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test") r := LinuxFunctionAppResource{} @@ -1211,6 +1207,15 @@ func TestAccLinuxFunctionApp_appStackNodeUpdate(t *testing.T) { ), }, data.ImportStep(), + { + Config: r.appStackNode(data, SkuBasicPlan, "22"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"), + check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("NODE|22"), + ), + }, + data.ImportStep(), { Config: r.appStackNode(data, SkuBasicPlan, "14"), Check: acceptance.ComposeTestCheckFunc( @@ -1589,30 +1594,7 @@ func TestAccLinuxFunctionApp_storageAccountKeyVaultSecretVersionless(t *testing. }) } -// TODO 4.0 remove post 4.0 -func TestAccLinuxFunctionAppASEv3_basic(t *testing.T) { - if features.FourPointOhBeta() { - t.Skip("skipped as test not valid in 4.0 mode") - } - - data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test") - r := LinuxFunctionAppResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.withASEV3(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep("site_credential.0.password"), - }) -} - func TestAccLinuxFunctionAppASEv3_basicWithVnetProperties(t *testing.T) { - if !features.FourPointOhBeta() { - t.Skip("this test requires 4.0 mode") - } data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test") r := LinuxFunctionAppResource{} @@ -1757,9 +1739,6 @@ func TestAccLinuxFunctionApp_basicPlanBackupShouldError(t *testing.T) { } func TestAccLinuxFunctionApp_vNetIntegrationWithVnetProperties(t *testing.T) { - if !features.FourPointOhBeta() { - t.Skip("this test requires 4.0 mode") - } data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test") r := LinuxFunctionAppResource{} @@ -1777,74 +1756,6 @@ func TestAccLinuxFunctionApp_vNetIntegrationWithVnetProperties(t *testing.T) { }) } -// TODO 4.0 remove post 4.0 -func TestAccLinuxFunctionApp_vNetIntegration(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test") - r := LinuxFunctionAppResource{} - - var vnetIntegrationProperties string - if features.FourPointOhBeta() { - vnetIntegrationProperties = r.vNetIntegration_subnet1WithVnetProperties(data, SkuStandardPlan) - } else { - vnetIntegrationProperties = r.vNetIntegration_subnet1(data, SkuStandardPlan) - } - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: vnetIntegrationProperties, - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("virtual_network_subnet_id").MatchesOtherKey( - check.That("azurerm_subnet.test1").Key("id"), - ), - ), - }, - data.ImportStep("site_credential.0.password"), - }) -} - -// TODO 4.0 remove post 4.0 -func TestAccLinuxFunctionApp_vNetIntegrationUpdate(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test") - r := LinuxFunctionAppResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.vNetIntegration_basic(data, SkuStandardPlan), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep("site_credential.0.password"), - { - Config: r.vNetIntegration_subnet1(data, SkuStandardPlan), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("virtual_network_subnet_id").MatchesOtherKey( - check.That("azurerm_subnet.test1").Key("id"), - ), - ), - }, - data.ImportStep("site_credential.0.password"), - { - Config: r.vNetIntegration_subnet2(data, SkuStandardPlan), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("virtual_network_subnet_id").MatchesOtherKey( - check.That("azurerm_subnet.test2").Key("id"), - ), - ), - }, - data.ImportStep("site_credential.0.password"), - { - Config: r.vNetIntegration_basic(data, SkuStandardPlan), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep("site_credential.0.password"), - }) -} - func TestAccLinuxFunctionApp_vNetIntegrationUpdateWithVnetProperties(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test") r := LinuxFunctionAppResource{} @@ -4444,132 +4355,6 @@ resource "azurerm_linux_function_app" "test" { `, r.template(data, planSku), data.RandomInteger, data.RandomInteger) } -// TODO 4.0 remove this test case as it's replaced by vNetIntegration_subnet1WithVnetProperties -func (r LinuxFunctionAppResource) vNetIntegration_subnet1(data acceptance.TestData, planSku string) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_virtual_network" "test" { - name = "vnet-%d" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name -} - -resource "azurerm_subnet" "test1" { - name = "subnet1" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.1.0/24"] - - delegation { - name = "delegation" - - service_delegation { - name = "Microsoft.Web/serverFarms" - actions = ["Microsoft.Network/virtualNetworks/subnets/action"] - } - } -} - -resource "azurerm_subnet" "test2" { - name = "subnet2" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.2.0/24"] - - delegation { - name = "delegation" - - service_delegation { - name = "Microsoft.Web/serverFarms" - actions = ["Microsoft.Network/virtualNetworks/subnets/action"] - } - } -} - -resource "azurerm_linux_function_app" "test" { - name = "acctest-LFA-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - service_plan_id = azurerm_service_plan.test.id - virtual_network_subnet_id = azurerm_subnet.test1.id - - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - - site_config {} -} -`, r.template(data, planSku), data.RandomInteger, data.RandomInteger) -} - -// TODO 4.0 remove this test case as it's replaced by vNetIntegration_subnet2WithVnetProperties -func (r LinuxFunctionAppResource) vNetIntegration_subnet2(data acceptance.TestData, planSku string) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_virtual_network" "test" { - name = "vnet-%d" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name -} - -resource "azurerm_subnet" "test1" { - name = "subnet1" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.1.0/24"] - - delegation { - name = "delegation" - - service_delegation { - name = "Microsoft.Web/serverFarms" - actions = ["Microsoft.Network/virtualNetworks/subnets/action"] - } - } -} - -resource "azurerm_subnet" "test2" { - name = "subnet2" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.2.0/24"] - - delegation { - name = "delegation" - - service_delegation { - name = "Microsoft.Web/serverFarms" - actions = ["Microsoft.Network/virtualNetworks/subnets/action"] - } - } -} - -resource "azurerm_linux_function_app" "test" { - name = "acctest-LFA-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - service_plan_id = azurerm_service_plan.test.id - virtual_network_subnet_id = azurerm_subnet.test2.id - - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - - site_config {} -} -`, r.template(data, planSku), data.RandomInteger, data.RandomInteger) -} - func (r LinuxFunctionAppResource) vNetIntegration_subnet1WithVnetProperties(data acceptance.TestData, planSku string) string { return fmt.Sprintf(` provider "azurerm" { @@ -4696,36 +4481,6 @@ resource "azurerm_linux_function_app" "test" { `, r.template(data, planSku), data.RandomInteger, data.RandomInteger) } -// TODO 4.0 remove this test case as it's replaced by withASEV3VnetProperties -func (r LinuxFunctionAppResource) withASEV3(data acceptance.TestData) string { - return fmt.Sprintf(` -%s -resource "azurerm_storage_account" "test" { - name = "acctestsa%s" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - account_tier = "Standard" - account_replication_type = "LRS" -} - -resource "azurerm_linux_function_app" "test" { - name = "acctest-LFA-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - service_plan_id = azurerm_service_plan.test.id - - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - - site_config { - vnet_route_all_enabled = true - } - - vnet_image_pull_enabled = true // Must be true for ASE deployed apps -} -`, ServicePlanResource{}.aseV3Linux(data), data.RandomString, data.RandomInteger) -} - func (r LinuxFunctionAppResource) withASEV3VnetProperties(data acceptance.TestData) string { return fmt.Sprintf(` %s diff --git a/internal/services/appservice/linux_function_app_slot_resource_test.go b/internal/services/appservice/linux_function_app_slot_resource_test.go index a04b4fc21685..c2fe48dbd053 100644 --- a/internal/services/appservice/linux_function_app_slot_resource_test.go +++ b/internal/services/appservice/linux_function_app_slot_resource_test.go @@ -15,7 +15,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -339,9 +338,6 @@ func TestAccLinuxFunctionAppSlot_consumptionCompleteUpdate(t *testing.T) { } func TestAccLinuxFunctionAppSlot_elasticPremiumCompleteWithVnetProperties(t *testing.T) { - if !features.FourPointOhBeta() { - t.Skip("this test requires 4.0 mode") - } data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") r := LinuxFunctionAppSlotResource{} @@ -373,9 +369,6 @@ func TestAccLinuxFunctionAppSlot_elasticPremiumComplete(t *testing.T) { } func TestAccLinuxFunctionAppSlot_standardCompleteWithVnetProperties(t *testing.T) { - if !features.FourPointOhBeta() { - t.Skip("this test requires 4.0 mode") - } data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") r := LinuxFunctionAppSlotResource{} @@ -425,9 +418,6 @@ func TestAccLinuxFunctionAppSlot_withAuthSettingsStandard(t *testing.T) { } func TestAccLinuxFunctionAppSlot_scmIpRestrictionSubnetWithVnetProperties(t *testing.T) { - if !features.FourPointOhBeta() { - t.Skip("this test requires 4.0 mode") - } data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") r := LinuxFunctionAppSlotResource{} @@ -1249,42 +1239,9 @@ func TestAccLinuxFunctionAppSlot_vNetIntegration(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") r := LinuxFunctionAppSlotResource{} - var vnetIntegrationProperties string - if features.FourPointOhBeta() { - vnetIntegrationProperties = r.vNetIntegration_subnet1WithVnetProperties(data, SkuStandardPlan) - } else { - vnetIntegrationProperties = r.vNetIntegration_subnet1(data, SkuStandardPlan) - } - data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: vnetIntegrationProperties, - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("virtual_network_subnet_id").MatchesOtherKey( - check.That("azurerm_subnet.test1").Key("id"), - ), - ), - }, - data.ImportStep("site_credential.0.password"), - }) -} - -// TODO 4.0 remove post 4.0 -func TestAccLinuxFunctionAppSlot_vNetIntegrationUpdate(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") - r := LinuxFunctionAppSlotResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.vNetIntegration_basic(data, SkuStandardPlan), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep("site_credential.0.password"), - { - Config: r.vNetIntegration_subnet1(data, SkuStandardPlan), + Config: r.vNetIntegration_subnet1WithVnetProperties(data, SkuStandardPlan), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("virtual_network_subnet_id").MatchesOtherKey( @@ -1293,30 +1250,10 @@ func TestAccLinuxFunctionAppSlot_vNetIntegrationUpdate(t *testing.T) { ), }, data.ImportStep("site_credential.0.password"), - { - Config: r.vNetIntegration_subnet2(data, SkuStandardPlan), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("virtual_network_subnet_id").MatchesOtherKey( - check.That("azurerm_subnet.test2").Key("id"), - ), - ), - }, - data.ImportStep("site_credential.0.password"), - { - Config: r.vNetIntegration_basic(data, SkuStandardPlan), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep("site_credential.0.password"), }) } func TestAccLinuxFunctionAppSlot_vNetIntegrationUpdateWithVnetProperties(t *testing.T) { - if !features.FourPointOhBeta() { - t.Skip("this test requires 4.0 mode") - } data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") r := LinuxFunctionAppSlotResource{} @@ -1358,26 +1295,7 @@ func TestAccLinuxFunctionAppSlot_vNetIntegrationUpdateWithVnetProperties(t *test }) } -// TODO 4.0 remove post 4.0 -func TestAccLinuxFunctionAppSlotASEv3_basic(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") - r := LinuxFunctionAppSlotResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.withASEV3(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep("site_credential.0.password"), - }) -} - func TestAccLinuxFunctionAppSlotASEv3_basicWithVnetProperties(t *testing.T) { - if !features.FourPointOhBeta() { - t.Skip("this test requires 4.0 mode") - } data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") r := LinuxFunctionAppSlotResource{} @@ -1584,7 +1502,8 @@ resource "azurerm_linux_function_app_slot" "test" { storage_account_access_key = azurerm_storage_account.test.primary_access_key site_config { - health_check_path = "/health" + health_check_path = "/health" + health_check_eviction_time_in_min = 3 } } `, r.template(data, planSku), data.RandomInteger) @@ -2413,10 +2332,11 @@ resource "azurerm_linux_function_app_slot" "test" { } } - use_32_bit_worker = true - websockets_enabled = true - ftps_state = "FtpsOnly" - health_check_path = "/health-check" + use_32_bit_worker = true + websockets_enabled = true + ftps_state = "FtpsOnly" + health_check_path = "/health-check" + health_check_eviction_time_in_min = 3 application_stack { python_version = "3.9" @@ -2604,11 +2524,12 @@ resource "azurerm_linux_function_app_slot" "test" { } } - use_32_bit_worker = true - websockets_enabled = true - ftps_state = "FtpsOnly" - health_check_path = "/health-check" - worker_count = 3 + use_32_bit_worker = true + websockets_enabled = true + ftps_state = "FtpsOnly" + health_check_path = "/health-check" + health_check_eviction_time_in_min = 3 + worker_count = 3 minimum_tls_version = "1.1" scm_minimum_tls_version = "1.1" @@ -2794,11 +2715,12 @@ resource "azurerm_linux_function_app_slot" "test" { } } - use_32_bit_worker = true - websockets_enabled = true - ftps_state = "FtpsOnly" - health_check_path = "/health-check" - worker_count = 3 + use_32_bit_worker = true + websockets_enabled = true + ftps_state = "FtpsOnly" + health_check_path = "/health-check" + health_check_eviction_time_in_min = 3 + worker_count = 3 minimum_tls_version = "1.1" scm_minimum_tls_version = "1.1" @@ -3014,11 +2936,12 @@ resource "azurerm_linux_function_app_slot" "test" { } } - use_32_bit_worker = true - websockets_enabled = true - ftps_state = "FtpsOnly" - health_check_path = "/health-check" - worker_count = 3 + use_32_bit_worker = true + websockets_enabled = true + ftps_state = "FtpsOnly" + health_check_path = "/health-check" + health_check_eviction_time_in_min = 3 + worker_count = 3 minimum_tls_version = "1.1" scm_minimum_tls_version = "1.1" @@ -3154,11 +3077,12 @@ resource "azurerm_linux_function_app_slot" "test" { } } - use_32_bit_worker = true - websockets_enabled = true - ftps_state = "FtpsOnly" - health_check_path = "/health-check" - worker_count = 3 + use_32_bit_worker = true + websockets_enabled = true + ftps_state = "FtpsOnly" + health_check_path = "/health-check" + health_check_eviction_time_in_min = 3 + worker_count = 3 minimum_tls_version = "1.1" scm_minimum_tls_version = "1.1" @@ -3706,66 +3630,6 @@ resource "azurerm_user_assigned_identity" "test" { `, r.template(data, planSku), data.RandomInteger) } -// TODO 4.0 remove this test case as it's replaced by vNetIntegration_basicWithVnetProperties -func (r LinuxFunctionAppSlotResource) vNetIntegration_basic(data acceptance.TestData, planSku string) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_virtual_network" "test" { - name = "vnet-%d" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name -} - -resource "azurerm_subnet" "test1" { - name = "subnet1" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.1.0/24"] - - delegation { - name = "delegation" - - service_delegation { - name = "Microsoft.Web/serverFarms" - actions = ["Microsoft.Network/virtualNetworks/subnets/action"] - } - } -} - -resource "azurerm_subnet" "test2" { - name = "subnet2" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.2.0/24"] - - delegation { - name = "delegation" - - service_delegation { - name = "Microsoft.Web/serverFarms" - actions = ["Microsoft.Network/virtualNetworks/subnets/action"] - } - } -} - -resource "azurerm_linux_function_app_slot" "test" { - name = "acctest-LFAS-%d" - function_app_id = azurerm_linux_function_app.test.id - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - - site_config {} -} - -`, r.template(data, planSku), data.RandomInteger, data.RandomInteger) -} - func (r LinuxFunctionAppSlotResource) vNetIntegration_basicWithVnetProperties(data acceptance.TestData, planSku string) string { return fmt.Sprintf(` provider "azurerm" { @@ -3827,66 +3691,6 @@ resource "azurerm_linux_function_app_slot" "test" { `, r.template(data, planSku), data.RandomInteger, data.RandomInteger) } -// TODO 4.0 remove this test case as it's replaced by vNetIntegration_subnet1WithVnetProperties -func (r LinuxFunctionAppSlotResource) vNetIntegration_subnet1(data acceptance.TestData, planSku string) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_virtual_network" "test" { - name = "vnet-%d" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name -} - -resource "azurerm_subnet" "test1" { - name = "subnet1" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.1.0/24"] - - delegation { - name = "delegation" - - service_delegation { - name = "Microsoft.Web/serverFarms" - actions = ["Microsoft.Network/virtualNetworks/subnets/action"] - } - } -} - -resource "azurerm_subnet" "test2" { - name = "subnet2" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.2.0/24"] - - delegation { - name = "delegation" - - service_delegation { - name = "Microsoft.Web/serverFarms" - actions = ["Microsoft.Network/virtualNetworks/subnets/action"] - } - } -} - -resource "azurerm_linux_function_app_slot" "test" { - name = "acctest-LFAS-%d" - function_app_id = azurerm_linux_function_app.test.id - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - virtual_network_subnet_id = azurerm_subnet.test1.id - - site_config {} -} -`, r.template(data, planSku), data.RandomInteger, data.RandomInteger) -} - func (r LinuxFunctionAppSlotResource) vNetIntegration_subnet1WithVnetProperties(data acceptance.TestData, planSku string) string { return fmt.Sprintf(` provider "azurerm" { @@ -3947,66 +3751,6 @@ resource "azurerm_linux_function_app_slot" "test" { `, r.template(data, planSku), data.RandomInteger, data.RandomInteger) } -// TODO 4.0 remove this test case as it's replaced by vNetIntegration_subnet2WithVnetProperties -func (r LinuxFunctionAppSlotResource) vNetIntegration_subnet2(data acceptance.TestData, planSku string) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_virtual_network" "test" { - name = "vnet-%d" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name -} - -resource "azurerm_subnet" "test1" { - name = "subnet1" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.1.0/24"] - - delegation { - name = "delegation" - - service_delegation { - name = "Microsoft.Web/serverFarms" - actions = ["Microsoft.Network/virtualNetworks/subnets/action"] - } - } -} - -resource "azurerm_subnet" "test2" { - name = "subnet2" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.2.0/24"] - - delegation { - name = "delegation" - - service_delegation { - name = "Microsoft.Web/serverFarms" - actions = ["Microsoft.Network/virtualNetworks/subnets/action"] - } - } -} - -resource "azurerm_linux_function_app_slot" "test" { - name = "acctest-LFAS-%d" - function_app_id = azurerm_linux_function_app.test.id - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - virtual_network_subnet_id = azurerm_subnet.test2.id - - site_config {} -} -`, r.template(data, planSku), data.RandomInteger, data.RandomInteger) -} - func (r LinuxFunctionAppSlotResource) vNetIntegration_subnet2WithVnetProperties(data acceptance.TestData, planSku string) string { return fmt.Sprintf(` provider "azurerm" { @@ -4067,47 +3811,6 @@ resource "azurerm_linux_function_app_slot" "test" { `, r.template(data, planSku), data.RandomInteger, data.RandomInteger) } -// TODO 4.0 remove this test case as it's replaced by withASEV3WithVnetProperties -func (r LinuxFunctionAppSlotResource) withASEV3(data acceptance.TestData) string { - return fmt.Sprintf(` -%[1]s - -resource "azurerm_storage_account" "test" { - name = "acctestsa%[2]s" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - account_tier = "Standard" - account_replication_type = "LRS" -} - -resource "azurerm_linux_function_app" "test" { - name = "acctest-LFA-%[3]d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - service_plan_id = azurerm_service_plan.test.id - - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - - site_config { - vnet_route_all_enabled = true - } -} - -resource "azurerm_linux_function_app_slot" "test" { - name = "acctest-LFAS-%[3]d" - function_app_id = azurerm_linux_function_app.test.id - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - - site_config { - vnet_route_all_enabled = true - } -} - -`, ServicePlanResource{}.aseV3Linux(data), data.RandomString, data.RandomInteger) -} - func (r LinuxFunctionAppSlotResource) withASEV3WithVnetProperties(data acceptance.TestData) string { return fmt.Sprintf(` %[1]s diff --git a/internal/services/appservice/linux_web_app_resource_test.go b/internal/services/appservice/linux_web_app_resource_test.go index c93fb0edd654..508b9e7af122 100644 --- a/internal/services/appservice/linux_web_app_resource_test.go +++ b/internal/services/appservice/linux_web_app_resource_test.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -62,24 +61,6 @@ func TestAccLinuxWebApp_updateTags(t *testing.T) { }) } -func TestAccLinuxWebApp_healthCheckTimeoutOnly(t *testing.T) { - if features.FourPointOhBeta() { - t.Skip("skipping as not valid config in 4.0") - } - data := acceptance.BuildTestData(t, "azurerm_linux_web_app", "test") - r := LinuxWebAppResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.healthCheckOnly(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep("site_credential.0.password"), - }) -} - func TestAccLinuxWebApp_freeSkuAlwaysOnShouldFail(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_linux_web_app", "test") r := LinuxWebAppResource{} @@ -1234,96 +1215,6 @@ func TestAccLinuxWebApp_withJre21Java(t *testing.T) { // TODO - finish known Java matrix combination tests...? -func TestAccLinuxWebApp_withDocker(t *testing.T) { - if features.FourPointOhBeta() { - t.Skipf("Skippped as deprecated property removed in 4.0") - } - - data := acceptance.BuildTestData(t, "azurerm_linux_web_app", "test") - r := LinuxWebAppResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.dockerMCR(data, "mcr.microsoft.com/appsvc/staticsite", "latest"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("DOCKER|mcr.microsoft.com/appsvc/staticsite:latest"), - ), - }, - data.ImportStep("app_settings.%", - "app_settings.DOCKER_REGISTRY_SERVER_PASSWORD", - "app_settings.DOCKER_REGISTRY_SERVER_URL", - "app_settings.DOCKER_REGISTRY_SERVER_USERNAME", - "site_config.0.application_stack.0.docker_image", - "site_config.0.application_stack.0.docker_image_name", - "site_config.0.application_stack.0.docker_image_tag", - "site_config.0.application_stack.0.docker_registry_url", - "site_credential.0.password"), - }) -} - -func TestAccLinuxWebApp_withDockerHub(t *testing.T) { - if features.FourPointOhBeta() { - t.Skipf("Skippped as deprecated property removed in 4.0") - } - data := acceptance.BuildTestData(t, "azurerm_linux_web_app", "test") - r := LinuxWebAppResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.dockerHub(data, "nginx", "latest"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("DOCKER|nginx:latest"), - ), - }, - data.ImportStep("app_settings.%", - "app_settings.DOCKER_REGISTRY_SERVER_PASSWORD", - "app_settings.DOCKER_REGISTRY_SERVER_URL", - "app_settings.DOCKER_REGISTRY_SERVER_USERNAME", - "site_config.0.application_stack.0.docker_image", - "site_config.0.application_stack.0.docker_image_name", - "site_config.0.application_stack.0.docker_image_tag", - "site_config.0.application_stack.0.docker_registry_url", - "site_credential.0.password"), - }) -} - -func TestAccLinuxWebApp_withDockerDeprecatedUpgrade(t *testing.T) { - if features.FourPointOhBeta() { - t.Skipf("Skippped as deprecated property removed in 4.0") - } - data := acceptance.BuildTestData(t, "azurerm_linux_web_app", "test") - r := LinuxWebAppResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.dockerHub(data, "nginx", "latest"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("DOCKER|nginx:latest"), - ), - }, - data.ImportStep("app_settings.%", - "app_settings.DOCKER_REGISTRY_SERVER_PASSWORD", - "app_settings.DOCKER_REGISTRY_SERVER_URL", - "app_settings.DOCKER_REGISTRY_SERVER_USERNAME", - "site_config.0.application_stack.0.docker_image", - "site_config.0.application_stack.0.docker_image_name", - "site_config.0.application_stack.0.docker_image_tag", - "site_config.0.application_stack.0.docker_registry_url", - "site_credential.0.password"), - { - Config: r.dockerImageName(data, "https://index.docker.io", "nginx:latest"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("DOCKER|index.docker.io/nginx:latest"), - ), - }, - data.ImportStep("site_credential.0.password"), - }) -} - func TestAccLinuxWebApp_withDockerImageMCR(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_linux_web_app", "test") r := LinuxWebAppResource{} @@ -1863,27 +1754,6 @@ resource "azurerm_linux_web_app" "test" { `, r.baseTemplate(data), data.RandomInteger) } -func (r LinuxWebAppResource) healthCheckOnly(data acceptance.TestData) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_linux_web_app" "test" { - name = "acctestWA-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - service_plan_id = azurerm_service_plan.test.id - - site_config { - health_check_eviction_time_in_min = 5 - } -} -`, r.baseTemplate(data), data.RandomInteger) -} - func (r LinuxWebAppResource) linuxFreeSku(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { @@ -3209,68 +3079,6 @@ resource "azurerm_linux_web_app" "test" { `, r.premiumV3PlanTemplate(data), data.RandomInteger, javaVersion, javaServer, javaServerVersion) } -func (r LinuxWebAppResource) dockerMCR(data acceptance.TestData, containerImage, containerTag string) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_linux_web_app" "test" { - name = "acctestWA-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - service_plan_id = azurerm_service_plan.test.id - - app_settings = { - "DOCKER_REGISTRY_SERVER_URL" = "https://mcr.microsoft.com" - "DOCKER_REGISTRY_SERVER_USERNAME" = "" - "DOCKER_REGISTRY_SERVER_PASSWORD" = "" - "WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false" - } - - site_config { - application_stack { - docker_image = "%s" - docker_image_tag = "%s" - } - } -} -`, r.baseTemplate(data), data.RandomInteger, containerImage, containerTag) -} - -func (r LinuxWebAppResource) dockerHub(data acceptance.TestData, containerImage, containerTag string) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_linux_web_app" "test" { - name = "acctestWA-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - service_plan_id = azurerm_service_plan.test.id - - app_settings = { - "DOCKER_REGISTRY_SERVER_URL" = "https://index.docker.io" - "DOCKER_REGISTRY_SERVER_USERNAME" = "" - "DOCKER_REGISTRY_SERVER_PASSWORD" = "" - "WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false" - } - - site_config { - application_stack { - docker_image = "%s" - docker_image_tag = "%s" - } - } -} -`, r.baseTemplate(data), data.RandomInteger, containerImage, containerTag) -} - func (r LinuxWebAppResource) dockerImageName(data acceptance.TestData, registryUrl, containerImage string) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/appservice/linux_web_app_slot_resource_test.go b/internal/services/appservice/linux_web_app_slot_resource_test.go index 5774a386e6d7..89fa4a95538a 100644 --- a/internal/services/appservice/linux_web_app_slot_resource_test.go +++ b/internal/services/appservice/linux_web_app_slot_resource_test.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -1214,95 +1213,6 @@ func TestAccLinuxWebAppSlot_withJava8JBOSSEAP73(t *testing.T) { }) } -func TestAccLinuxWebAppSlot_withDocker(t *testing.T) { - if features.FourPointOhBeta() { - t.Skipf("Skippped as deprecated property removed in 4.0") - } - data := acceptance.BuildTestData(t, "azurerm_linux_web_app_slot", "test") - r := LinuxWebAppSlotResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.docker(data, "mcr.microsoft.com/appsvc/staticsite", "latest"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("DOCKER|mcr.microsoft.com/appsvc/staticsite:latest"), - ), - }, - data.ImportStep("app_settings.%", - "app_settings.DOCKER_REGISTRY_SERVER_PASSWORD", - "app_settings.DOCKER_REGISTRY_SERVER_URL", - "app_settings.DOCKER_REGISTRY_SERVER_USERNAME", - "site_config.0.application_stack.0.docker_image", - "site_config.0.application_stack.0.docker_image_name", - "site_config.0.application_stack.0.docker_image_tag", - "site_config.0.application_stack.0.docker_registry_url", - "site_credential.0.password"), - }) -} - -func TestAccLinuxWebAppSlot_withDockerHub(t *testing.T) { - if features.FourPointOhBeta() { - t.Skipf("Skippped as deprecated property removed in 4.0") - } - data := acceptance.BuildTestData(t, "azurerm_linux_web_app_slot", "test") - r := LinuxWebAppSlotResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.dockerHub(data, "nginx", "latest"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("DOCKER|nginx:latest"), - ), - }, - data.ImportStep("app_settings.%", - "app_settings.DOCKER_REGISTRY_SERVER_PASSWORD", - "app_settings.DOCKER_REGISTRY_SERVER_URL", - "app_settings.DOCKER_REGISTRY_SERVER_USERNAME", - "site_config.0.application_stack.0.docker_image", - "site_config.0.application_stack.0.docker_image_name", - "site_config.0.application_stack.0.docker_image_tag", - "site_config.0.application_stack.0.docker_registry_url", - "site_credential.0.password"), - }) -} - -func TestAccLinuxWebAppSlot_withDockerDeprecatedUpgrade(t *testing.T) { - if features.FourPointOhBeta() { - t.Skipf("Skippped as deprecated property removed in 4.0") - } - data := acceptance.BuildTestData(t, "azurerm_linux_web_app_slot", "test") - r := LinuxWebAppSlotResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.dockerHub(data, "nginx", "latest"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("DOCKER|nginx:latest"), - ), - }, - data.ImportStep("app_settings.%", - "app_settings.DOCKER_REGISTRY_SERVER_PASSWORD", - "app_settings.DOCKER_REGISTRY_SERVER_URL", - "app_settings.DOCKER_REGISTRY_SERVER_USERNAME", - "site_config.0.application_stack.0.docker_image", - "site_config.0.application_stack.0.docker_image_name", - "site_config.0.application_stack.0.docker_image_tag", - "site_config.0.application_stack.0.docker_registry_url", - "site_credential.0.password"), - { - Config: r.dockerImageName(data, "https://index.docker.io", "nginx:latest"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("DOCKER|index.docker.io/nginx:latest"), - ), - }, - data.ImportStep("site_credential.0.password"), - }) -} - func TestAccLinuxWebAppSlot_withDockerImageMCR(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_linux_web_app_slot", "test") r := LinuxWebAppSlotResource{} @@ -2625,67 +2535,6 @@ resource "azurerm_linux_web_app_slot" "test" { `, r.premiumV3PlanTemplate(data), data.RandomInteger, javaVersion, javaServer, javaServerVersion) } -func (r LinuxWebAppSlotResource) docker(data acceptance.TestData, containerImage, containerTag string) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_linux_web_app_slot" "test" { - name = "acctestWAS-%d" - app_service_id = azurerm_linux_web_app.test.id - - app_settings = { - "DOCKER_REGISTRY_SERVER_URL" = "https://mcr.microsoft.com" - "DOCKER_REGISTRY_SERVER_USERNAME" = "" - "DOCKER_REGISTRY_SERVER_PASSWORD" = "" - "WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false" - - } - - site_config { - application_stack { - docker_image = "%s" - docker_image_tag = "%s" - } - } -} - -`, r.baseTemplate(data), data.RandomInteger, containerImage, containerTag) -} - -func (r LinuxWebAppSlotResource) dockerHub(data acceptance.TestData, containerImage, containerTag string) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_linux_web_app_slot" "test" { - name = "acctestWAS-%d" - app_service_id = azurerm_linux_web_app.test.id - - app_settings = { - "DOCKER_REGISTRY_SERVER_URL" = "https://index.docker.io" - "DOCKER_REGISTRY_SERVER_USERNAME" = "" - "DOCKER_REGISTRY_SERVER_PASSWORD" = "" - "WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false" - } - - site_config { - application_stack { - docker_image = "%s" - docker_image_tag = "%s" - } - } -} - -`, r.baseTemplate(data), data.RandomInteger, containerImage, containerTag) -} - func (r LinuxWebAppSlotResource) dockerImageName(data acceptance.TestData, registryUrl, containerImage string) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/appservice/windows_function_app_resource_test.go b/internal/services/appservice/windows_function_app_resource_test.go index ecd7de408344..03c4814b8201 100644 --- a/internal/services/appservice/windows_function_app_resource_test.go +++ b/internal/services/appservice/windows_function_app_resource_test.go @@ -15,7 +15,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -1182,6 +1181,14 @@ func TestAccWindowsFunctionApp_appStackNodeUpdate(t *testing.T) { ), }, data.ImportStep("site_credential.0.password"), + { + Config: r.appStackNode(data, SkuBasicPlan, "~22"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp"), + ), + }, + data.ImportStep("site_credential.0.password"), }) } @@ -1503,15 +1510,9 @@ func TestAccWindowsFunctionApp_vNetIntegration(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_windows_function_app", "test") r := WindowsFunctionAppResource{} - var vnetIntegrationProperties string - if features.FourPointOhBeta() { - vnetIntegrationProperties = r.vNetIntegration_subnet1WithVnetProperties(data, SkuStandardPlan) - } else { - vnetIntegrationProperties = r.vNetIntegration_subnet1(data, SkuStandardPlan) - } data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: vnetIntegrationProperties, + Config: r.vNetIntegration_subnet1WithVnetProperties(data, SkuStandardPlan), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("virtual_network_subnet_id").MatchesOtherKey( @@ -3901,33 +3902,6 @@ resource "azurerm_windows_function_app" "test" { // TODO 4.0 enable the vnet_image_pull_enabled property for app running in ase env func (r WindowsFunctionAppResource) withASEV3(data acceptance.TestData) string { - if !features.FourPointOhBeta() { - return fmt.Sprintf(` -%s - -resource "azurerm_storage_account" "test" { - name = "acctestsa%s" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - account_tier = "Standard" - account_replication_type = "LRS" -} - -resource "azurerm_windows_function_app" "test" { - name = "acctest-WFA-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - service_plan_id = azurerm_service_plan.test.id - - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - - site_config { - vnet_route_all_enabled = true - } -} -`, ServicePlanResource{}.aseV3(data), data.RandomString, data.RandomInteger) - } return fmt.Sprintf(` %s diff --git a/internal/services/appservice/windows_function_app_slot_resource_authv2_test.go b/internal/services/appservice/windows_function_app_slot_resource_authv2_test.go index 3a1aa0aa5591..e9623436a7c4 100644 --- a/internal/services/appservice/windows_function_app_slot_resource_authv2_test.go +++ b/internal/services/appservice/windows_function_app_slot_resource_authv2_test.go @@ -843,11 +843,13 @@ resource "azurerm_windows_function_app_slot" "test" { } } - use_32_bit_worker = true - websockets_enabled = true - ftps_state = "FtpsOnly" - health_check_path = "/health-check" - worker_count = 3 + use_32_bit_worker = true + websockets_enabled = true + ftps_state = "FtpsOnly" + health_check_path = "/health-check" + health_check_eviction_time_in_min = 3 + + worker_count = 3 minimum_tls_version = "1.1" scm_minimum_tls_version = "1.1" diff --git a/internal/services/appservice/windows_function_app_slot_resource_test.go b/internal/services/appservice/windows_function_app_slot_resource_test.go index 31b71d1ff03e..774b571e2be2 100644 --- a/internal/services/appservice/windows_function_app_slot_resource_test.go +++ b/internal/services/appservice/windows_function_app_slot_resource_test.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -1112,16 +1111,9 @@ func TestAccWindowsFunctionAppSlot_vNetIntegration(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_windows_function_app_slot", "test") r := WindowsFunctionAppSlotResource{} - var vnetIntegrationProperties string - if features.FourPointOhBeta() { - vnetIntegrationProperties = r.vNetIntegration_subnet1WithVnetProperties(data, SkuStandardPlan) - } else { - vnetIntegrationProperties = r.vNetIntegration_subnet1(data, SkuStandardPlan) - } - data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: vnetIntegrationProperties, + Config: r.vNetIntegration_subnet1WithVnetProperties(data, SkuStandardPlan), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("virtual_network_subnet_id").MatchesOtherKey( @@ -1728,10 +1720,11 @@ resource "azurerm_windows_function_app_slot" "test" { } } - use_32_bit_worker = true - websockets_enabled = true - ftps_state = "FtpsOnly" - health_check_path = "/health-check" + use_32_bit_worker = true + websockets_enabled = true + ftps_state = "FtpsOnly" + health_check_path = "/health-check" + health_check_eviction_time_in_min = 3 application_stack { powershell_core_version = "7" @@ -1915,11 +1908,12 @@ resource "azurerm_windows_function_app_slot" "test" { } } - use_32_bit_worker = true - websockets_enabled = true - ftps_state = "FtpsOnly" - health_check_path = "/health-check" - worker_count = 3 + use_32_bit_worker = true + websockets_enabled = true + ftps_state = "FtpsOnly" + health_check_path = "/health-check" + health_check_eviction_time_in_min = 3 + worker_count = 3 minimum_tls_version = "1.1" scm_minimum_tls_version = "1.1" @@ -2049,11 +2043,12 @@ resource "azurerm_windows_function_app_slot" "test" { } } - use_32_bit_worker = true - websockets_enabled = true - ftps_state = "FtpsOnly" - health_check_path = "/health-check" - worker_count = 3 + use_32_bit_worker = true + websockets_enabled = true + ftps_state = "FtpsOnly" + health_check_path = "/health-check" + health_check_eviction_time_in_min = 3 + worker_count = 3 minimum_tls_version = "1.1" scm_minimum_tls_version = "1.1" @@ -2231,7 +2226,8 @@ resource "azurerm_windows_function_app_slot" "test" { storage_account_access_key = azurerm_storage_account.test.primary_access_key site_config { - health_check_path = "/health" + health_check_path = "/health" + health_check_eviction_time_in_min = 3 } } `, r.template(data, planSku), data.RandomInteger) @@ -3198,47 +3194,6 @@ resource "azurerm_windows_function_app_slot" "test" { } func (r WindowsFunctionAppSlotResource) withASEV3(data acceptance.TestData) string { - if !features.FourPointOhBeta() { - return fmt.Sprintf(` -%[1]s - -resource "azurerm_storage_account" "test" { - name = "acctestsa%[2]s" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - account_tier = "Standard" - account_replication_type = "LRS" -} - -resource "azurerm_windows_function_app" "test" { - name = "acctest-WFA-%[3]d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - service_plan_id = azurerm_service_plan.test.id - - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - - vnet_image_pull_enabled = true - site_config { - vnet_route_all_enabled = true - } -} - -resource "azurerm_windows_function_app_slot" "test" { - name = "acctest-WFAS-%[3]d" - function_app_id = azurerm_windows_function_app.test.id - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - - site_config { - vnet_route_all_enabled = true - } -} - -`, ServicePlanResource{}.aseV3(data), data.RandomString, data.RandomInteger) - } - return fmt.Sprintf(` %[1]s diff --git a/internal/services/appservice/windows_web_app_resource_test.go b/internal/services/appservice/windows_web_app_resource_test.go index 9798e01b64a1..21723c6504ae 100644 --- a/internal/services/appservice/windows_web_app_resource_test.go +++ b/internal/services/appservice/windows_web_app_resource_test.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -1036,70 +1035,6 @@ func TestAccWindowsWebApp_withJava110414Tomcat10020(t *testing.T) { }) } -func TestAccWindowsWebApp_dockerHub(t *testing.T) { - if features.FourPointOhBeta() { - t.Skipf("Skippped as deprecated property removed in 4.0") - } - - data := acceptance.BuildTestData(t, "azurerm_windows_web_app", "test") - r := WindowsWebAppResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.dockerHub(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.windows_fx_version").HasValue("DOCKER|traefik:windowsservercore-1809"), - ), - }, - data.ImportStep("app_settings.%", - "site_config.0.application_stack.0.docker_container_name", - "site_config.0.application_stack.0.docker_container_tag", - "site_config.0.application_stack.0.docker_image_name", - "site_config.0.application_stack.0.docker_registry_url", - "app_settings.DOCKER_REGISTRY_SERVER_PASSWORD", - "app_settings.DOCKER_REGISTRY_SERVER_URL", - "app_settings.DOCKER_REGISTRY_SERVER_USERNAME", - "site_credential.0.password"), - }) -} - -func TestAccWindowsWebApp_withDockerDeprecatedUpgrade(t *testing.T) { - if features.FourPointOhBeta() { - t.Skipf("Skippped as deprecated property removed in 4.0") - } - - data := acceptance.BuildTestData(t, "azurerm_windows_web_app", "test") - r := WindowsWebAppResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.dockerHub(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.windows_fx_version").HasValue("DOCKER|traefik:windowsservercore-1809"), - ), - }, - data.ImportStep("app_settings.%", - "site_config.0.application_stack.0.docker_container_name", - "site_config.0.application_stack.0.docker_container_tag", - "site_config.0.application_stack.0.docker_image_name", - "site_config.0.application_stack.0.docker_registry_url", - "app_settings.DOCKER_REGISTRY_SERVER_PASSWORD", - "app_settings.DOCKER_REGISTRY_SERVER_URL", - "app_settings.DOCKER_REGISTRY_SERVER_USERNAME", - "site_credential.0.password"), - { - Config: r.dockerImageName(data, "https://index.docker.io", "traefik:windowsservercore-1809"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.windows_fx_version").HasValue("DOCKER|traefik:windowsservercore-1809"), - ), - }, - data.ImportStep("site_credential.0.password"), - }) -} - func TestAccWindowsWebApp_withDockerImageMCR(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_windows_web_app", "test") r := WindowsWebAppResource{} @@ -2850,37 +2785,6 @@ resource "azurerm_windows_web_app" "test" { `, r.baseTemplate(data), data.RandomInteger, dotNetVersion) } -func (r WindowsWebAppResource) dockerHub(data acceptance.TestData) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_windows_web_app" "test" { - name = "acctestWA-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - service_plan_id = azurerm_service_plan.test.id - - app_settings = { - "DOCKER_REGISTRY_SERVER_URL" = "https://index.docker.io" - "DOCKER_REGISTRY_SERVER_USERNAME" = "" - "DOCKER_REGISTRY_SERVER_PASSWORD" = "" - "WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false" - } - - site_config { - application_stack { - docker_container_name = "traefik" - docker_container_tag = "windowsservercore-1809" - } - } -} -`, r.premiumV3PlanContainerTemplate(data), data.RandomInteger) -} - func (r WindowsWebAppResource) dockerImageName(data acceptance.TestData, registryUrl, containerImage string) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/appservice/windows_web_app_slot_resource_test.go b/internal/services/appservice/windows_web_app_slot_resource_test.go index 62abaf0d6fba..80d49e0106d5 100644 --- a/internal/services/appservice/windows_web_app_slot_resource_test.go +++ b/internal/services/appservice/windows_web_app_slot_resource_test.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -997,69 +996,6 @@ func TestAccWindowsWebAppSlot_withJava11014Tomcat9(t *testing.T) { }) } -func TestAccWindowsWebAppSlot_withDockerHub(t *testing.T) { - if features.FourPointOhBeta() { - t.Skipf("Skippped as deprecated property removed in 4.0") - } - - data := acceptance.BuildTestData(t, "azurerm_windows_web_app_slot", "test") - r := WindowsWebAppSlotResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.dockerHub(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep("app_settings.%", - "site_config.0.application_stack.0.docker_container_name", - "site_config.0.application_stack.0.docker_container_tag", - "site_config.0.application_stack.0.docker_image_name", - "site_config.0.application_stack.0.docker_registry_url", - "app_settings.DOCKER_REGISTRY_SERVER_PASSWORD", - "app_settings.DOCKER_REGISTRY_SERVER_URL", - "app_settings.DOCKER_REGISTRY_SERVER_USERNAME", - "site_credential.0.password"), - }) -} - -func TestAccWindowsWebAppSlot_withDockerDeprecatedUpgrade(t *testing.T) { - if features.FourPointOhBeta() { - t.Skipf("Skippped as deprecated property removed in 4.0") - } - - data := acceptance.BuildTestData(t, "azurerm_windows_web_app_slot", "test") - r := WindowsWebAppSlotResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.dockerHub(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.windows_fx_version").HasValue("DOCKER|traefik:windowsservercore-1809"), - ), - }, - data.ImportStep("app_settings.%", - "site_config.0.application_stack.0.docker_container_name", - "site_config.0.application_stack.0.docker_container_tag", - "site_config.0.application_stack.0.docker_image_name", - "site_config.0.application_stack.0.docker_registry_url", - "app_settings.DOCKER_REGISTRY_SERVER_PASSWORD", - "app_settings.DOCKER_REGISTRY_SERVER_URL", - "app_settings.DOCKER_REGISTRY_SERVER_USERNAME", - "site_credential.0.password"), - { - Config: r.dockerImageName(data, "https://index.docker.io", "traefik:windowsservercore-1809"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("site_config.0.windows_fx_version").HasValue("DOCKER|traefik:windowsservercore-1809"), - ), - }, - data.ImportStep("site_credential.0.password"), - }) -} - func TestAccWindowsWebAppSlot_withDockerImageMCR(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_windows_web_app_slot", "test") r := WindowsWebAppSlotResource{} @@ -2282,35 +2218,6 @@ resource "azurerm_windows_web_app_slot" "test" { `, r.baseTemplate(data), data.RandomInteger, javaVersion, tomcatVersion) } -func (r WindowsWebAppSlotResource) dockerHub(data acceptance.TestData) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_windows_web_app_slot" "test" { - name = "acctestWAS-%d" - app_service_id = azurerm_windows_web_app.test.id - - app_settings = { - "DOCKER_REGISTRY_SERVER_URL" = "https://index.docker.io" - "DOCKER_REGISTRY_SERVER_USERNAME" = "" - "DOCKER_REGISTRY_SERVER_PASSWORD" = "" - "WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false" - } - - site_config { - application_stack { - docker_container_name = "traefik" - docker_container_tag = "windowsservercore-1809" - } - } -} -`, r.premiumV3PlanContainerTemplateDocker(data), data.RandomInteger) -} - func (r WindowsWebAppSlotResource) dockerImageName(data acceptance.TestData, registryUrl, containerImage string) string { return fmt.Sprintf(` provider "azurerm" { @@ -2762,45 +2669,6 @@ resource "azurerm_windows_web_app" "test" { `, data.RandomInteger, data.Locations.Primary) } -func (WindowsWebAppSlotResource) premiumV3PlanContainerTemplateDocker(data acceptance.TestData) string { - return fmt.Sprintf(` - -resource "azurerm_resource_group" "test" { - name = "acctestRG-%[1]d" - location = "%[2]s" -} - -resource "azurerm_service_plan" "test" { - name = "acctestASP-%[1]d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - sku_name = "P1v3" - os_type = "WindowsContainer" -} - -resource "azurerm_windows_web_app" "test" { - name = "acctestWA-%[1]d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - service_plan_id = azurerm_service_plan.test.id - - app_settings = { - "DOCKER_REGISTRY_SERVER_URL" = "https://index.docker.io" - "DOCKER_REGISTRY_SERVER_USERNAME" = "" - "DOCKER_REGISTRY_SERVER_PASSWORD" = "" - "WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false" - } - - site_config { - application_stack { - docker_container_name = "traefik" - docker_container_tag = "windowsservercore-1809" - } - } -} -`, data.RandomInteger, data.Locations.Primary) -} - func (r WindowsWebAppSlotResource) vNetIntegrationWebApp_basic(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go index 551c37d629d3..615f580d24d2 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package arckubernetes import ( diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go index 1eb16ce31ef5..04005eadca33 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package arckubernetes_test import ( diff --git a/internal/services/containerapps/container_app_resource_test.go b/internal/services/containerapps/container_app_resource_test.go index 3c42c8f8a64f..d8ee1530fa8a 100644 --- a/internal/services/containerapps/container_app_resource_test.go +++ b/internal/services/containerapps/container_app_resource_test.go @@ -1387,6 +1387,8 @@ resource "azurerm_container_app" "test" { max_replicas = 3 revision_suffix = "%[3]s" + + termination_grace_period_seconds = 60 } ingress { diff --git a/internal/services/containerapps/helpers/container_apps.go b/internal/services/containerapps/helpers/container_apps.go index 8a99c54f347d..56755711d548 100644 --- a/internal/services/containerapps/helpers/container_apps.go +++ b/internal/services/containerapps/helpers/container_apps.go @@ -813,16 +813,17 @@ func ContainerAppEnvironmentDaprMetadataSchema() *pluginsdk.Schema { } type ContainerTemplate struct { - Containers []Container `tfschema:"container"` - InitContainers []BaseContainer `tfschema:"init_container"` - Suffix string `tfschema:"revision_suffix"` - MinReplicas int64 `tfschema:"min_replicas"` - MaxReplicas int64 `tfschema:"max_replicas"` - AzureQueueScaleRules []AzureQueueScaleRule `tfschema:"azure_queue_scale_rule"` - CustomScaleRules []CustomScaleRule `tfschema:"custom_scale_rule"` - HTTPScaleRules []HTTPScaleRule `tfschema:"http_scale_rule"` - TCPScaleRules []TCPScaleRule `tfschema:"tcp_scale_rule"` - Volumes []ContainerVolume `tfschema:"volume"` + Containers []Container `tfschema:"container"` + InitContainers []BaseContainer `tfschema:"init_container"` + Suffix string `tfschema:"revision_suffix"` + MinReplicas int64 `tfschema:"min_replicas"` + MaxReplicas int64 `tfschema:"max_replicas"` + AzureQueueScaleRules []AzureQueueScaleRule `tfschema:"azure_queue_scale_rule"` + CustomScaleRules []CustomScaleRule `tfschema:"custom_scale_rule"` + HTTPScaleRules []HTTPScaleRule `tfschema:"http_scale_rule"` + TCPScaleRules []TCPScaleRule `tfschema:"tcp_scale_rule"` + Volumes []ContainerVolume `tfschema:"volume"` + TerminationGracePeriod int64 `tfschema:"termination_grace_period_seconds"` } func ContainerTemplateSchema() *pluginsdk.Schema { @@ -868,6 +869,13 @@ func ContainerTemplateSchema() *pluginsdk.Schema { Computed: true, // Note: O+C This value is always present and non-zero but if not user specified, then the service will generate a value. Description: "The suffix for the revision. This value must be unique for the lifetime of the Resource. If omitted the service will use a hash function to create one.", }, + + "termination_grace_period_seconds": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(0, 600), + Description: "The time in seconds after the container is sent the termination signal before the process if forcibly killed.", + }, }, }, } @@ -921,9 +929,10 @@ func ExpandContainerAppTemplate(input []ContainerTemplate, metadata sdk.Resource config := input[0] template := &containerapps.Template{ - Containers: expandContainerAppContainers(config.Containers), - InitContainers: expandInitContainerAppContainers(config.InitContainers), - Volumes: expandContainerAppVolumes(config.Volumes), + Containers: expandContainerAppContainers(config.Containers), + InitContainers: expandInitContainerAppContainers(config.InitContainers), + Volumes: expandContainerAppVolumes(config.Volumes), + TerminationGracePeriodSeconds: pointer.To(config.TerminationGracePeriod), } if config.MaxReplicas != 0 { @@ -962,10 +971,11 @@ func FlattenContainerAppTemplate(input *containerapps.Template) []ContainerTempl return []ContainerTemplate{} } result := ContainerTemplate{ - Containers: flattenContainerAppContainers(input.Containers), - InitContainers: flattenInitContainerAppContainers(input.InitContainers), - Suffix: pointer.From(input.RevisionSuffix), - Volumes: flattenContainerAppVolumes(input.Volumes), + Containers: flattenContainerAppContainers(input.Containers), + InitContainers: flattenInitContainerAppContainers(input.InitContainers), + Suffix: pointer.From(input.RevisionSuffix), + TerminationGracePeriod: pointer.From(input.TerminationGracePeriodSeconds), + Volumes: flattenContainerAppVolumes(input.Volumes), } if scale := input.Scale; scale != nil { diff --git a/internal/services/containers/client/client.go b/internal/services/containers/client/client.go index e24090f037a0..79c0e9423fc7 100644 --- a/internal/services/containers/client/client.go +++ b/internal/services/containers/client/client.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2023-05-01/containerinstance" containerregistry_v2019_06_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2019-06-01-preview" "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/cacherules" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/credentialsets" containerregistry "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-11-01-preview" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-04-01/fleetupdatestrategies" @@ -28,6 +29,7 @@ type Client struct { AgentPoolsClient *agentpools.AgentPoolsClient ContainerInstanceClient *containerinstance.ContainerInstanceClient CacheRulesClient *cacherules.CacheRulesClient + CredentialSetsClient *credentialsets.CredentialSetsClient ContainerRegistryClient *containerregistry.Client // v2019_06_01_preview is needed for container registry agent pools and tasks ContainerRegistryClient_v2019_06_01_preview *containerregistry_v2019_06_01_preview.Client @@ -69,6 +71,12 @@ func NewContainersClient(o *common.ClientOptions) (*Client, error) { } o.Configure(cacheRulesClient.Client, o.Authorizers.ResourceManager) + credentialSetsClient, err := credentialsets.NewCredentialSetsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Credential Sets client: %+v", err) + } + o.Configure(credentialSetsClient.Client, o.Authorizers.ResourceManager) + // AKS fleetUpdateRunsClient, err := updateruns.NewUpdateRunsClientWithBaseURI(o.Environment.ResourceManager) if err != nil { @@ -128,6 +136,7 @@ func NewContainersClient(o *common.ClientOptions) (*Client, error) { AgentPoolsClient: agentPoolsClient, ContainerInstanceClient: containerInstanceClient, CacheRulesClient: cacheRulesClient, + CredentialSetsClient: credentialSetsClient, ContainerRegistryClient: containerRegistryClient, ContainerRegistryClient_v2019_06_01_preview: containerRegistryClient_v2019_06_01_preview, FleetUpdateRunsClient: fleetUpdateRunsClient, diff --git a/internal/services/containers/container_registry_credential_set_resource.go b/internal/services/containers/container_registry_credential_set_resource.go new file mode 100644 index 000000000000..01ce86b6f6f6 --- /dev/null +++ b/internal/services/containers/container_registry_credential_set_resource.go @@ -0,0 +1,281 @@ +package containers + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/credentialsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-11-01-preview/registries" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ sdk.Resource = ContainerRegistryCredentialSetResource{} + +type ContainerRegistryCredentialSetResource struct{} + +func (ContainerRegistryCredentialSetResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + Description: "The name of the credential set.", + }, + "container_registry_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: registries.ValidateRegistryID, + }, + "login_server": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + "authentication_credentials": { + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "username_secret_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: keyVaultValidate.VersionlessNestedItemId, + }, + "password_secret_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: keyVaultValidate.VersionlessNestedItemId, + }, + }, + }, + }, + // This property relies on a pandora workaround due to a swagger issue + // https://github.com/Azure/azure-rest-api-specs/issues/32154 + "identity": commonschema.SystemAssignedIdentityRequired(), + } +} + +func (ContainerRegistryCredentialSetResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +type AuthenticationCredential struct { + UsernameSecretId string `tfschema:"username_secret_id"` + PasswordSecretId string `tfschema:"password_secret_id"` +} + +type ContainerRegistryCredentialSetModel struct { + Name string `tfschema:"name"` + ContainerRegistryId string `tfschema:"container_registry_id"` + LoginServer string `tfschema:"login_server"` + AuthenticationCredential []AuthenticationCredential `tfschema:"authentication_credentials"` + Identity []identity.ModelSystemAssigned `tfschema:"identity"` +} + +func (ContainerRegistryCredentialSetResource) ModelObject() interface{} { + return &ContainerRegistryCredentialSetModel{} +} + +func (ContainerRegistryCredentialSetResource) ResourceType() string { + return "azurerm_container_registry_credential_set" +} + +func (r ContainerRegistryCredentialSetResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Containers.CredentialSetsClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var config ContainerRegistryCredentialSetModel + if err := metadata.Decode(&config); err != nil { + return err + } + + log.Printf("[INFO] preparing arguments for Container Registry Credential Set creation.") + + registryId, err := registries.ParseRegistryID(config.ContainerRegistryId) + if err != nil { + return err + } + + id := credentialsets.NewCredentialSetID(subscriptionId, + registryId.ResourceGroupName, + registryId.RegistryName, + config.Name, + ) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + identityExpanded, err := identity.ExpandSystemAssignedFromModel(config.Identity) + if err != nil { + return fmt.Errorf("expanding `identity`: %+v", err) + } + + param := credentialsets.CredentialSet{ + Name: pointer.To(id.CredentialSetName), + Properties: &credentialsets.CredentialSetProperties{ + LoginServer: pointer.To(config.LoginServer), + AuthCredentials: expandAuthCredentials(config.AuthenticationCredential), + }, + Identity: identityExpanded, + } + + if err := client.CreateThenPoll(ctx, id, param); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ContainerRegistryCredentialSetResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Containers.CredentialSetsClient + id, err := credentialsets.ParseCredentialSetID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + param := credentialsets.CredentialSetUpdateParameters{} + + var model ContainerRegistryCredentialSetModel + if err := metadata.Decode(&model); err != nil { + return err + } + + properties := credentialsets.CredentialSetUpdateProperties{} + + if metadata.ResourceData.HasChange("authentication_credentials") { + properties.AuthCredentials = expandAuthCredentials(model.AuthenticationCredential) + } + + param.Properties = &properties + + if metadata.ResourceData.HasChange("identity") { + identityExpanded, err := identity.ExpandSystemAssignedFromModel(model.Identity) + if err != nil { + return fmt.Errorf("expanding `identity`: %+v", err) + } + param.Identity = identityExpanded + } + + if err := client.UpdateThenPoll(ctx, *id, param); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + return nil + }, + } +} + +func (ContainerRegistryCredentialSetResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Containers.CredentialSetsClient + id, err := credentialsets.ParseCredentialSetID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + registryId := registries.NewRegistryID(id.SubscriptionId, id.ResourceGroupName, id.RegistryName) + + var config ContainerRegistryCredentialSetModel + if err := metadata.Decode(&config); err != nil { + return err + } + + config.Name = id.CredentialSetName + config.ContainerRegistryId = registryId.ID() + + if model := resp.Model; model != nil { + config.Identity = identity.FlattenSystemAssignedToModel(model.Identity) + if props := model.Properties; props != nil { + config.LoginServer = pointer.From(props.LoginServer) + config.AuthenticationCredential = flattenAuthCredentials(props.AuthCredentials) + } + } + return metadata.Encode(&config) + }, + } +} + +func (ContainerRegistryCredentialSetResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Containers.CredentialSetsClient + id, err := credentialsets.ParseCredentialSetID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + return nil + }, + } +} + +func (ContainerRegistryCredentialSetResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return credentialsets.ValidateCredentialSetID +} + +func expandAuthCredentials(input []AuthenticationCredential) *[]credentialsets.AuthCredential { + output := make([]credentialsets.AuthCredential, 0) + if len(input) == 0 { + return &output + } + for _, v := range input { + output = append(output, credentialsets.AuthCredential{ + Name: pointer.To(credentialsets.CredentialNameCredentialOne), + UsernameSecretIdentifier: pointer.To(v.UsernameSecretId), + PasswordSecretIdentifier: pointer.To(v.PasswordSecretId), + }) + } + return &output +} + +func flattenAuthCredentials(input *[]credentialsets.AuthCredential) []AuthenticationCredential { + output := make([]AuthenticationCredential, 0) + if input == nil { + return output + } + for _, v := range *input { + output = append(output, AuthenticationCredential{ + UsernameSecretId: pointer.From(v.UsernameSecretIdentifier), + PasswordSecretId: pointer.From(v.PasswordSecretIdentifier), + }) + } + return output +} diff --git a/internal/services/containers/container_registry_credential_set_resource_test.go b/internal/services/containers/container_registry_credential_set_resource_test.go new file mode 100644 index 000000000000..eb590c0118aa --- /dev/null +++ b/internal/services/containers/container_registry_credential_set_resource_test.go @@ -0,0 +1,242 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package containers_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/credentialsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type ContainerRegistryCredentialSetResource struct{} + +func TestAccContainerRegistryCredentialSet_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_registry_credential_set", "test") + r := ContainerRegistryCredentialSetResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerRegistryCredentialSet_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_registry_credential_set", "test") + r := ContainerRegistryCredentialSetResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccContainerRegistryCredentialSet_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_registry_credential_set", "test") + r := ContainerRegistryCredentialSetResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (ContainerRegistryCredentialSetResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := credentialsets.ParseCredentialSetID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.Containers.CredentialSetsClient.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func (ContainerRegistryCredentialSetResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "accTestRG-acr-credetial-set-%d" + location = "%s" +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_key_vault" "test" { + name = "vault%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.current.tenant_id + sku_name = "standard" + soft_delete_retention_days = 7 + + access_policy { + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = data.azurerm_client_config.current.object_id + certificate_permissions = [] + key_permissions = [] + secret_permissions = [ + "Get", "Set", "Delete", "Purge" + ] + } +} + +resource "azurerm_key_vault_secret" "test-user-name" { + key_vault_id = azurerm_key_vault.test.id + name = "acr-cs-user-name" + value = "name" +} + +resource "azurerm_key_vault_secret" "test-user-password" { + key_vault_id = azurerm_key_vault.test.id + name = "acr-cs-user-password" + value = "password" +} + +resource "azurerm_container_registry" "test" { + name = "testacccr%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "Basic" +} + +resource "azurerm_container_registry_credential_set" "test" { + name = "testacc-acr-credential-set-%d" + container_registry_id = azurerm_container_registry.test.id + login_server = "docker.io" + identity { + type = "SystemAssigned" + } + authentication_credentials { + username_secret_id = azurerm_key_vault_secret.test-user-name.versionless_id + password_secret_id = azurerm_key_vault_secret.test-user-password.versionless_id + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) +} + +func (r ContainerRegistryCredentialSetResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_registry_credential_set" "import" { + name = azurerm_container_registry_credential_set.test.name + container_registry_id = azurerm_container_registry_credential_set.test.container_registry_id + login_server = azurerm_container_registry_credential_set.test.login_server + identity { + type = "SystemAssigned" + } + authentication_credentials { + username_secret_id = azurerm_container_registry_credential_set.test.authentication_credentials[0].username_secret_id + password_secret_id = azurerm_container_registry_credential_set.test.authentication_credentials[0].password_secret_id + } +} +`, r.basic(data)) +} + +func (ContainerRegistryCredentialSetResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "accTestRG-acr-credetial-set-%d" + location = "%s" +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_key_vault" "test" { + name = "vault%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.current.tenant_id + sku_name = "standard" + soft_delete_retention_days = 7 + + access_policy { + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = data.azurerm_client_config.current.object_id + certificate_permissions = [] + key_permissions = [] + secret_permissions = [ + "Get", "Set", "Delete", "Purge" + ] + } +} + +resource "azurerm_key_vault_secret" "test-user-name" { + key_vault_id = azurerm_key_vault.test.id + name = "acr-cs-user-name" + value = "name" +} + +resource "azurerm_key_vault_secret" "test-user-password" { + key_vault_id = azurerm_key_vault.test.id + name = "acr-cs-user-password" + value = "password" +} + +resource "azurerm_key_vault_secret" "test-other-user-password" { + key_vault_id = azurerm_key_vault.test.id + name = "acr-cs-other-user-password" + value = "otherpassword" +} + +resource "azurerm_container_registry" "test" { + name = "testacccr%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "Basic" +} + +resource "azurerm_container_registry_credential_set" "test" { + name = "testacc-acr-credential-set-%d" + container_registry_id = azurerm_container_registry.test.id + login_server = "docker.io" + identity { + type = "SystemAssigned" + } + authentication_credentials { + username_secret_id = azurerm_key_vault_secret.test-user-name.versionless_id + password_secret_id = azurerm_key_vault_secret.test-other-user-password.versionless_id + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) +} diff --git a/internal/services/containers/kubernetes_cluster_node_pool_resource.go b/internal/services/containers/kubernetes_cluster_node_pool_resource.go index 48a7a6304563..ee2a399ee906 100644 --- a/internal/services/containers/kubernetes_cluster_node_pool_resource.go +++ b/internal/services/containers/kubernetes_cluster_node_pool_resource.go @@ -112,7 +112,6 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema { "vm_size": { Type: pluginsdk.TypeString, Required: true, - ForceNew: true, ValidateFunc: validation.StringIsNotEmpty, }, @@ -141,14 +140,13 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema { }, false), }, - "kubelet_config": schemaNodePoolKubeletConfigForceNew(), + "kubelet_config": schemaNodePoolKubeletConfig(), - "linux_os_config": schemaNodePoolLinuxOSConfigForceNew(), + "linux_os_config": schemaNodePoolLinuxOSConfig(), "fips_enabled": { Type: pluginsdk.TypeBool, Optional: true, - ForceNew: true, }, "gpu_instance": { @@ -184,7 +182,6 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeInt, Optional: true, Computed: true, - ForceNew: true, }, "mode": { @@ -242,7 +239,6 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema { "os_disk_size_gb": { Type: pluginsdk.TypeInt, Optional: true, - ForceNew: true, Computed: true, ValidateFunc: validation.IntAtLeast(1), }, @@ -250,7 +246,6 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema { "os_disk_type": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, Default: agentpools.OSDiskTypeManaged, ValidateFunc: validation.StringInSlice([]string{ string(agentpools.OSDiskTypeEphemeral), @@ -284,7 +279,6 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema { "pod_subnet_id": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, ValidateFunc: commonids.ValidateSubnetID, }, @@ -309,7 +303,6 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema { "snapshot_id": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, ValidateFunc: snapshots.ValidateSnapshotID, }, @@ -331,9 +324,14 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema { }, false), }, + "temporary_name_for_rotation": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: containerValidate.KubernetesAgentPoolName, + }, + "ultra_ssd_enabled": { Type: pluginsdk.TypeBool, - ForceNew: true, Default: false, Optional: true, }, @@ -341,7 +339,6 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema { "vnet_subnet_id": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, ValidateFunc: commonids.ValidateSubnetID, }, @@ -373,7 +370,7 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema { }, false), }, - "zones": commonschema.ZonesMultipleOptionalForceNew(), + "zones": commonschema.ZonesMultipleOptional(), "auto_scaling_enabled": { Type: pluginsdk.TypeBool, @@ -383,13 +380,11 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema { "node_public_ip_enabled": { Type: pluginsdk.TypeBool, Optional: true, - ForceNew: true, }, "host_encryption_enabled": { Type: pluginsdk.TypeBool, Optional: true, - ForceNew: true, }, } @@ -723,10 +718,39 @@ func resourceKubernetesClusterNodePoolUpdate(d *pluginsdk.ResourceData, meta int props.EnableAutoScaling = utils.Bool(enableAutoScaling) } + if d.HasChange("fips_enabled") { + props.EnableFIPS = pointer.To(d.Get("fips_enabled").(bool)) + } + + if d.HasChange("host_encryption_enabled") { + props.EnableEncryptionAtHost = pointer.To(d.Get("host_encryption_enabled").(bool)) + } + + if d.HasChange("kubelet_config") { + kubeletConfigRaw := d.Get("kubelet_config").([]interface{}) + props.KubeletConfig = expandAgentPoolKubeletConfig(kubeletConfigRaw) + } + + if d.HasChange("linux_os_config") { + linuxOSConfigRaw := d.Get("linux_os_config").([]interface{}) + if d.Get("os_type").(string) != string(managedclusters.OSTypeLinux) { + return fmt.Errorf("`linux_os_config` can only be configured when `os_type` is set to `linux`") + } + linuxOSConfig, err := expandAgentPoolLinuxOSConfig(linuxOSConfigRaw) + if err != nil { + return err + } + props.LinuxOSConfig = linuxOSConfig + } + if d.HasChange("max_count") || enableAutoScaling { props.MaxCount = utils.Int64(int64(d.Get("max_count").(int))) } + if d.HasChange("max_pods") { + props.MaxPods = pointer.To(int64(d.Get("max_pods").(int))) + } + if d.HasChange("mode") { mode := agentpools.AgentPoolMode(d.Get("mode").(string)) props.Mode = &mode @@ -740,8 +764,12 @@ func resourceKubernetesClusterNodePoolUpdate(d *pluginsdk.ResourceData, meta int props.Count = utils.Int64(int64(d.Get("node_count").(int))) } + if d.HasChange("node_public_ip_enabled") { + props.EnableNodePublicIP = pointer.To(d.Get("node_public_ip_enabled").(bool)) + } + if d.HasChange("node_public_ip_prefix_id") { - props.NodePublicIPPrefixID = utils.String(d.Get("node_public_ip_prefix_id").(string)) + props.NodePublicIPPrefixID = pointer.To(d.Get("node_public_ip_prefix_id").(string)) } if d.HasChange("orchestrator_version") { @@ -768,10 +796,26 @@ func resourceKubernetesClusterNodePoolUpdate(d *pluginsdk.ResourceData, meta int props.Tags = tags.Expand(t) } + if d.HasChange("os_disk_type") { + props.OsDiskType = pointer.To(agentpools.OSDiskType(d.Get("os_disk_type").(string))) + } + + if d.HasChange("os_disk_size_gb") { + props.OsDiskSizeGB = pointer.To(int64(d.Get("os_disk_size_gb").(int))) + } + if d.HasChange("os_sku") { props.OsSKU = pointer.To(agentpools.OSSKU(d.Get("os_sku").(string))) } + if d.HasChange("pod_subnet_id") { + props.PodSubnetID = pointer.To(d.Get("pod_subnet_id").(string)) + } + + if d.HasChange("ultra_ssd_enabled") { + props.EnableUltraSSD = pointer.To(d.Get("ultra_ssd_enabled").(bool)) + } + if d.HasChange("upgrade_settings") { upgradeSettingsRaw := d.Get("upgrade_settings").([]interface{}) props.UpgradeSettings = expandAgentPoolUpgradeSettings(upgradeSettingsRaw) @@ -781,6 +825,27 @@ func resourceKubernetesClusterNodePoolUpdate(d *pluginsdk.ResourceData, meta int mode := agentpools.ScaleDownMode(d.Get("scale_down_mode").(string)) props.ScaleDownMode = &mode } + + if d.HasChange("snapshot_id") { + props.CreationData = &agentpools.CreationData{ + SourceResourceId: pointer.To(d.Get("snapshot_id").(string)), + } + } + + if d.HasChange("vm_size") { + props.VMSize = pointer.To(d.Get("vm_size").(string)) + } + + if d.HasChange("vnet_subnet_id") { + if subnetIDValue, ok := d.GetOk("vnet_subnet_id"); ok { + subnetID, err := commonids.ParseSubnetID(subnetIDValue.(string)) + if err != nil { + return err + } + props.VnetSubnetID = pointer.To(subnetID.ID()) + } + } + if d.HasChange("workload_runtime") { runtime := agentpools.WorkloadRuntime(d.Get("workload_runtime").(string)) props.WorkloadRuntime = &runtime @@ -798,6 +863,11 @@ func resourceKubernetesClusterNodePoolUpdate(d *pluginsdk.ResourceData, meta int props.NetworkProfile = expandAgentPoolNetworkProfile(d.Get("node_network_profile").([]interface{})) } + if d.HasChange("zones") { + zones := zones.ExpandUntyped(d.Get("zones").(*schema.Set).List()) + props.AvailabilityZones = &zones + } + // validate the auto-scale fields are both set/unset to prevent a continual diff maxCount := 0 if props.MaxCount != nil { @@ -825,11 +895,91 @@ func resourceKubernetesClusterNodePoolUpdate(d *pluginsdk.ResourceData, meta int props.MinCount = nil } - log.Printf("[DEBUG] Updating existing %s..", *id) - existing.Model.Properties = props - err = client.CreateOrUpdateThenPoll(ctx, *id, *existing.Model) - if err != nil { - return fmt.Errorf("updating Node Pool %s: %+v", *id, err) + // evaluate if the nodepool needs to be cycled + cycleNodePoolProperties := []string{ + "fips_enabled", + "host_encryption_enabled", + "kubelet_config", + "linux_os_config", + "max_pods", + "node_public_ip_enabled", + "os_disk_size_gb", + "os_disk_type", + "pod_subnet_id", + "snapshot_id", + "ultra_ssd_enabled", + "vm_size", + "vnet_subnet_id", + "zones", + } + + // if the node pool name has changed, it means the initial attempt at resizing failed + cycleNodePool := d.HasChanges(cycleNodePoolProperties...) + // os_sku can only be updated if the current and new os_sku are either Ubuntu or AzureLinux + if d.HasChange("os_sku") { + oldOsSkuRaw, newOsSkuRaw := d.GetChange("os_sku") + oldOsSku := oldOsSkuRaw.(string) + newOsSku := newOsSkuRaw.(string) + if oldOsSku != string(managedclusters.OSSKUUbuntu) && oldOsSku != string(managedclusters.OSSKUAzureLinux) { + cycleNodePool = true + } + if newOsSku != string(managedclusters.OSSKUUbuntu) && newOsSku != string(managedclusters.OSSKUAzureLinux) { + cycleNodePool = true + } + } + + if cycleNodePool { + log.Printf("[DEBUG] Cycling Node Pool..") + // to provide a seamless updating experience for the node pool we need to cycle it by provisioning a temporary one, + // tearing down the existing node pool and then bringing up the new one. + + if v := d.Get("temporary_name_for_rotation").(string); v == "" { + return fmt.Errorf("`temporary_name_for_rotation` must be specified when updating any of the following properties %q", cycleNodePoolProperties) + } + + temporaryNodePoolName := d.Get("temporary_name_for_rotation").(string) + tempNodePoolId := agentpools.NewAgentPoolID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, temporaryNodePoolName) + + tempExisting, err := client.Get(ctx, tempNodePoolId) + if !response.WasNotFound(tempExisting.HttpResponse) && err != nil { + return fmt.Errorf("checking for existing temporary node pool %s: %+v", tempNodePoolId, err) + } + + tempAgentProfile := *existing.Model + tempAgentProfile.Name = &temporaryNodePoolName + + // if the temp node pool already exists due to a previous failure, don't bother spinning it up. + // the temporary nodepool is created with the new values + if tempExisting.Model == nil { + if err := retryNodePoolCreation(ctx, client, tempNodePoolId, tempAgentProfile); err != nil { + return fmt.Errorf("creating temporary %s: %+v", tempNodePoolId, err) + } + } + + // delete the old node pool if it exists + if existing.Model != nil { + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting old %s: %+v", *id, err) + } + } + + // create the new node pool with the new data + if err := retryNodePoolCreation(ctx, client, *id, *existing.Model); err != nil { + log.Printf("[DEBUG] Creation of redefined node pool failed") + return fmt.Errorf("creating default %s: %+v", *id, err) + } + + if err := client.DeleteThenPoll(ctx, tempNodePoolId); err != nil { + return fmt.Errorf("deleting temporary %s: %+v", tempNodePoolId, err) + } + + log.Printf("[DEBUG] Cycled Node Pool..") + } else { + log.Printf("[DEBUG] Updating existing %s..", *id) + err = client.CreateOrUpdateThenPoll(ctx, *id, *existing.Model) + if err != nil { + return fmt.Errorf("updating Node Pool %s: %+v", *id, err) + } } d.Partial(false) diff --git a/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go b/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go index c8a2f658049a..dd0daaaf3537 100644 --- a/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go +++ b/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go @@ -10,6 +10,7 @@ import ( "testing" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/agentpools" @@ -309,6 +310,28 @@ func TestAccKubernetesClusterNodePool_manualScaleUpdate(t *testing.T) { }) } +func TestAccKubernetesClusterNodePool_manualScaleVMSku(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster_node_pool", "test") + r := KubernetesClusterNodePoolResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.manualScaleVMSkuConfig(data, "Standard_F2s_v2"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("temporary_name_for_rotation"), + { + Config: r.manualScaleVMSkuConfig(data, "Standard_F4s_v2"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("temporary_name_for_rotation"), + }) +} + func TestAccKubernetesClusterNodePool_modeSystem(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster_node_pool", "test") r := KubernetesClusterNodePoolResource{} @@ -729,13 +752,20 @@ func TestAccKubernetesClusterNodePool_ultraSSD(t *testing.T) { r := KubernetesClusterNodePoolResource{} data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.ultraSSD(data, false), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("temporary_name_for_rotation"), { Config: r.ultraSSD(data, true), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("temporary_name_for_rotation"), }) } @@ -1102,6 +1132,123 @@ func TestAccKubernetesClusterNodePool_virtualNetworkOwnershipRaceCondition(t *te }) } +func TestAccKubernetesClusterNodePool_updateVmSizeAfterFailureWithTempAndOriginal(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster_node_pool", "test") + r := KubernetesClusterNodePoolResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.manualScaleVMSkuConfig(data, "Standard_F2s_v2"), + Check: acceptance.ComposeTestCheckFunc( + check.That("azurerm_kubernetes_cluster_node_pool.test").ExistsInAzure(r), + // create the temporary node pool to simulate the case where both old node pool and temp node pool exist + data.CheckWithClientForResource(func(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) error { + if _, ok := ctx.Deadline(); !ok { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, 1*time.Hour) + defer cancel() + } + + client := clients.Containers.AgentPoolsClient + + originalNodePoolId, err := agentpools.ParseAgentPoolID(state.Attributes["id"]) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", originalNodePoolId, err) + } + + resp, err := client.Get(ctx, *originalNodePoolId) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *originalNodePoolId, err) + } + if resp.Model == nil { + return fmt.Errorf("retrieving %s: model was nil", *originalNodePoolId) + } + + tempNodePoolName := "temp" + profile := resp.Model + profile.Name = &tempNodePoolName + profile.Properties.VMSize = pointer.To("Standard_F4s_v2") + + tempNodePoolId := agentpools.NewAgentPoolID(originalNodePoolId.SubscriptionId, originalNodePoolId.ResourceGroupName, originalNodePoolId.ManagedClusterName, tempNodePoolName) + if err := client.CreateOrUpdateThenPoll(ctx, tempNodePoolId, *profile); err != nil { + return fmt.Errorf("creating %s: %+v", tempNodePoolId, err) + } + + return nil + }, data.ResourceName), + ), + }, + { + Config: r.manualScaleVMSkuConfig(data, "Standard_F4s_v2"), + Check: acceptance.ComposeTestCheckFunc( + check.That("azurerm_kubernetes_cluster_node_pool.test").ExistsInAzure(r), + ), + }, + data.ImportStep("temporary_name_for_rotation"), + }) +} + +func TestAccKubernetesClusterNodePool_updateVmSizeAfterFailureWithTempWithoutOriginal(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster_node_pool", "test") + r := KubernetesClusterNodePoolResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.manualScaleVMSkuConfig(data, "Standard_F2s_v2"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + // create the temporary node pool and delete the old node pool to simulate the case where resizing fails when trying to bring up the new node pool + data.CheckWithClientForResource(func(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) error { + if _, ok := ctx.Deadline(); !ok { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, 1*time.Hour) + defer cancel() + } + + client := clients.Containers.AgentPoolsClient + + originalNodePoolId, err := agentpools.ParseAgentPoolID(state.Attributes["id"]) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", originalNodePoolId, err) + } + resp, err := client.Get(ctx, *originalNodePoolId) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *originalNodePoolId, err) + } + if resp.Model == nil { + return fmt.Errorf("retrieving %s: model was nil", *originalNodePoolId) + } + + tempNodePoolName := "temp" + profile := resp.Model + profile.Name = &tempNodePoolName + profile.Properties.VMSize = pointer.To("Standard_F4s_v2") + + tempNodePoolId := agentpools.NewAgentPoolID(originalNodePoolId.SubscriptionId, originalNodePoolId.ResourceGroupName, originalNodePoolId.ManagedClusterName, tempNodePoolName) + if err := client.CreateOrUpdateThenPoll(ctx, tempNodePoolId, *profile); err != nil { + return fmt.Errorf("creating %s: %+v", tempNodePoolId, err) + } + + if err := client.DeleteThenPoll(ctx, *originalNodePoolId); err != nil { + return fmt.Errorf("deleting original %s: %+v", originalNodePoolId, err) + } + + return nil + }, data.ResourceName), + ), + // the plan will show that the default node pool name has been set to "temp" and we're trying to set it back to "default" + ExpectNonEmptyPlan: true, + }, + { + Config: r.manualScaleVMSkuConfig(data, "Standard_F4s_v2"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("temporary_name_for_rotation"), + }) +} + func (r KubernetesClusterNodePoolResource) autoScaleConfig(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { @@ -1559,6 +1706,24 @@ resource "azurerm_kubernetes_cluster_node_pool" "test" { `, r.templateConfig(data), numberOfAgents) } +func (r KubernetesClusterNodePoolResource) manualScaleVMSkuConfig(data acceptance.TestData, sku string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_kubernetes_cluster_node_pool" "test" { + name = "internal" + kubernetes_cluster_id = azurerm_kubernetes_cluster.test.id + vm_size = "%s" + node_count = 1 + temporary_name_for_rotation = "temporal" +} +`, r.templateConfig(data), sku) +} + func (r KubernetesClusterNodePoolResource) modeSystemConfig(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { @@ -2300,11 +2465,12 @@ resource "azurerm_kubernetes_cluster" "test" { } } resource "azurerm_kubernetes_cluster_node_pool" "test" { - name = "internal" - kubernetes_cluster_id = azurerm_kubernetes_cluster.test.id - vm_size = "Standard_D2s_v3" - ultra_ssd_enabled = %t - zones = ["1", "2", "3"] + name = "internal" + kubernetes_cluster_id = azurerm_kubernetes_cluster.test.id + vm_size = "Standard_D2s_v3" + temporary_name_for_rotation = "temporal" + ultra_ssd_enabled = %t + zones = ["1", "2", "3"] } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, ultraSSDEnabled) } diff --git a/internal/services/containers/kubernetes_cluster_resource.go b/internal/services/containers/kubernetes_cluster_resource.go index cbd23a719b70..ea916b50ebe8 100644 --- a/internal/services/containers/kubernetes_cluster_resource.go +++ b/internal/services/containers/kubernetes_cluster_resource.go @@ -2420,7 +2420,7 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} tempAgentProfile.Name = &temporaryNodePoolName // if the temp node pool already exists due to a previous failure, don't bother spinning it up if tempExisting.Model == nil { - if err := retrySystemNodePoolCreation(ctx, nodePoolsClient, tempNodePoolId, tempAgentProfile); err != nil { + if err := retryNodePoolCreation(ctx, nodePoolsClient, tempNodePoolId, tempAgentProfile); err != nil { return fmt.Errorf("creating temporary %s: %+v", tempNodePoolId, err) } } @@ -2433,7 +2433,7 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} } // create the default node pool with the new vm size - if err := retrySystemNodePoolCreation(ctx, nodePoolsClient, defaultNodePoolId, agentProfile); err != nil { + if err := retryNodePoolCreation(ctx, nodePoolsClient, defaultNodePoolId, agentProfile); err != nil { // if creation of the default node pool fails we automatically fall back to the temporary node pool // in func findDefaultNodePool log.Printf("[DEBUG] Creation of resized default node pool failed") @@ -4574,8 +4574,8 @@ func flattenKubernetesClusterMetricsProfile(input *managedclusters.ManagedCluste return pointer.From(input.CostAnalysis.Enabled) } -func retrySystemNodePoolCreation(ctx context.Context, client *agentpools.AgentPoolsClient, id agentpools.AgentPoolId, profile agentpools.AgentPool) error { - // retries the creation of a system node pool 3 times +func retryNodePoolCreation(ctx context.Context, client *agentpools.AgentPoolsClient, id agentpools.AgentPoolId, profile agentpools.AgentPool) error { + // retries the creation of a node pool 3 times var err error for attempt := 0; attempt < 3; attempt++ { if err = client.CreateOrUpdateThenPoll(ctx, id, profile); err == nil { diff --git a/internal/services/containers/kubernetes_nodepool.go b/internal/services/containers/kubernetes_nodepool.go index d8747c83769b..ed720a91f32e 100644 --- a/internal/services/containers/kubernetes_nodepool.go +++ b/internal/services/containers/kubernetes_nodepool.go @@ -353,96 +353,6 @@ func schemaNodePoolKubeletConfig() *pluginsdk.Schema { } } -func schemaNodePoolKubeletConfigForceNew() *pluginsdk.Schema { - return &pluginsdk.Schema{ - Type: pluginsdk.TypeList, - Optional: true, - ForceNew: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "cpu_manager_policy": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - "none", - "static", - }, false), - }, - - "cpu_cfs_quota_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Default: true, - ForceNew: true, - }, - - "cpu_cfs_quota_period": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - }, - - "image_gc_high_threshold": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(0, 100), - }, - - "image_gc_low_threshold": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(0, 100), - }, - - "topology_manager_policy": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - "none", - "best-effort", - "restricted", - "single-numa-node", - }, false), - }, - - "allowed_unsafe_sysctls": { - Type: pluginsdk.TypeSet, - Optional: true, - ForceNew: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "container_log_max_size_mb": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - }, - - // TODO 5.0: change this to `container_log_max_files` - "container_log_max_line": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntAtLeast(2), - }, - - "pod_max_pid": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - }, - }, - }, - } -} - func schemaNodePoolLinuxOSConfig() *pluginsdk.Schema { return &pluginsdk.Schema{ Type: pluginsdk.TypeList, @@ -483,50 +393,6 @@ func schemaNodePoolLinuxOSConfig() *pluginsdk.Schema { } } -func schemaNodePoolLinuxOSConfigForceNew() *pluginsdk.Schema { - return &pluginsdk.Schema{ - Type: pluginsdk.TypeList, - Optional: true, - ForceNew: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "sysctl_config": schemaNodePoolSysctlConfigForceNew(), - - "transparent_huge_page_enabled": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - "always", - "madvise", - "never", - }, false), - }, - - "transparent_huge_page_defrag": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - "always", - "defer", - "defer+madvise", - "madvise", - "never", - }, false), - }, - - "swap_file_size_mb": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - }, - }, - }, - } -} - func schemaNodePoolSysctlConfig() *pluginsdk.Schema { return &pluginsdk.Schema{ Type: pluginsdk.TypeList, @@ -711,220 +577,6 @@ func schemaNodePoolSysctlConfig() *pluginsdk.Schema { } } -func schemaNodePoolSysctlConfigForceNew() *pluginsdk.Schema { - return &pluginsdk.Schema{ - Type: pluginsdk.TypeList, - Optional: true, - ForceNew: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "fs_aio_max_nr": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(65536, 6553500), - }, - - "fs_file_max": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(8192, 12000500), - }, - - "fs_inotify_max_user_watches": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(781250, 2097152), - }, - - "fs_nr_open": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(8192, 20000500), - }, - - "kernel_threads_max": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(20, 513785), - }, - - "net_core_netdev_max_backlog": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(1000, 3240000), - }, - - "net_core_optmem_max": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(20480, 4194304), - }, - - "net_core_rmem_default": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(212992, 134217728), - }, - - "net_core_rmem_max": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(212992, 134217728), - }, - - "net_core_somaxconn": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(4096, 3240000), - }, - - "net_core_wmem_default": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(212992, 134217728), - }, - - "net_core_wmem_max": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(212992, 134217728), - }, - - "net_ipv4_ip_local_port_range_min": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(1024, 60999), - }, - - "net_ipv4_ip_local_port_range_max": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(32768, 65535), - }, - - "net_ipv4_neigh_default_gc_thresh1": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(128, 80000), - }, - - "net_ipv4_neigh_default_gc_thresh2": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(512, 90000), - }, - - "net_ipv4_neigh_default_gc_thresh3": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(1024, 100000), - }, - - "net_ipv4_tcp_fin_timeout": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(5, 120), - }, - - "net_ipv4_tcp_keepalive_intvl": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(10, 90), - }, - - "net_ipv4_tcp_keepalive_probes": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(1, 15), - }, - - "net_ipv4_tcp_keepalive_time": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(30, 432000), - }, - - "net_ipv4_tcp_max_syn_backlog": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(128, 3240000), - }, - - "net_ipv4_tcp_max_tw_buckets": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(8000, 1440000), - }, - - "net_ipv4_tcp_tw_reuse": { - Type: pluginsdk.TypeBool, - Optional: true, - ForceNew: true, - }, - - "net_netfilter_nf_conntrack_buckets": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(65536, 524288), - }, - - "net_netfilter_nf_conntrack_max": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(131072, 2097152), - }, - - "vm_max_map_count": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(65530, 262144), - }, - - "vm_swappiness": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(0, 100), - }, - - "vm_vfs_cache_pressure": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntBetween(0, 100), - }, - }, - }, - } -} - func schemaNodePoolNetworkProfile() *pluginsdk.Schema { return &pluginsdk.Schema{ Type: pluginsdk.TypeList, diff --git a/internal/services/containers/registration.go b/internal/services/containers/registration.go index 2cc036b54d67..7e278bd073ad 100644 --- a/internal/services/containers/registration.go +++ b/internal/services/containers/registration.go @@ -73,6 +73,7 @@ func (r Registration) Resources() []sdk.Resource { ContainerConnectedRegistryResource{}, ContainerRegistryCacheRule{}, ContainerRegistryTaskResource{}, + ContainerRegistryCredentialSetResource{}, ContainerRegistryTaskScheduleResource{}, ContainerRegistryTokenPasswordResource{}, KubernetesClusterExtensionResource{}, diff --git a/internal/services/datafactory/data_factory_test.go b/internal/services/datafactory/data_factory_test.go index 13ffc87f91fa..664f6fb844d8 100644 --- a/internal/services/datafactory/data_factory_test.go +++ b/internal/services/datafactory/data_factory_test.go @@ -121,11 +121,11 @@ func TestDataFactoryDeserializePipelineActivities(t *testing.T) { t.Fatal(err) } - if items == nil && !tc.ExpectErr { - t.Fatal("Expected items got nil") - } - - if len(*items) != tc.ExpectActivityCount { + if items == nil { + if !tc.ExpectErr { + t.Fatal("Expected items got nil") + } + } else if len(*items) != tc.ExpectActivityCount { t.Fatal("Failed to deserialise pipeline") } } diff --git a/internal/services/dataprotection/data_protection_backup_vault_resource.go b/internal/services/dataprotection/data_protection_backup_vault_resource.go index 02a1299cea7a..d0e7f91a1d0d 100644 --- a/internal/services/dataprotection/data_protection_backup_vault_resource.go +++ b/internal/services/dataprotection/data_protection_backup_vault_resource.go @@ -26,7 +26,7 @@ import ( ) func resourceDataProtectionBackupVault() *pluginsdk.Resource { - resource := &pluginsdk.Resource{ + return &pluginsdk.Resource{ Create: resourceDataProtectionBackupVaultCreateUpdate, Read: resourceDataProtectionBackupVaultRead, Update: resourceDataProtectionBackupVaultCreateUpdate, @@ -86,8 +86,6 @@ func resourceDataProtectionBackupVault() *pluginsdk.Resource { Optional: true, }, - "identity": commonschema.SystemAssignedIdentityOptional(), - "retention_duration_in_days": { Type: pluginsdk.TypeFloat, Optional: true, @@ -102,19 +100,34 @@ func resourceDataProtectionBackupVault() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice(backupvaults.PossibleValuesForSoftDeleteState(), false), }, + "immutability": { + Type: pluginsdk.TypeString, + Optional: true, + Default: backupvaults.ImmutabilityStateDisabled, + ValidateFunc: validation.StringInSlice(backupvaults.PossibleValuesForImmutabilityState(), false), + }, + + "identity": commonschema.SystemAssignedIdentityOptional(), + "tags": tags.Schema(), }, CustomizeDiff: pluginsdk.CustomDiffWithAll( - pluginsdk.ForceNewIfChange("soft_delete", func(ctx context.Context, old, new, meta interface{}) bool { - return old.(string) == string(backupvaults.SoftDeleteStateAlwaysOn) && new.(string) != string(backupvaults.SoftDeleteStateAlwaysOn) - }), // Once `cross_region_restore_enabled` is enabled it cannot be disabled. pluginsdk.ForceNewIfChange("cross_region_restore_enabled", func(ctx context.Context, old, new, meta interface{}) bool { return old.(bool) && new.(bool) != old.(bool) }), + // Once `immutability` is enabled it cannot be disabled. + pluginsdk.ForceNewIfChange("immutability", func(ctx context.Context, old, new, meta interface{}) bool { + return old.(string) == string(backupvaults.ImmutabilityStateLocked) && new.(string) != string(backupvaults.ImmutabilityStateLocked) + }), + + pluginsdk.ForceNewIfChange("soft_delete", func(ctx context.Context, old, new, meta interface{}) bool { + return old.(string) == string(backupvaults.SoftDeleteStateAlwaysOn) && new.(string) != string(backupvaults.SoftDeleteStateAlwaysOn) + }), + pluginsdk.CustomizeDiffShim(func(ctx context.Context, d *pluginsdk.ResourceDiff, v interface{}) error { redundancy := d.Get("redundancy").(string) crossRegionRestore := d.GetRawConfig().AsValueMap()["cross_region_restore_enabled"] @@ -126,8 +139,6 @@ func resourceDataProtectionBackupVault() *pluginsdk.Resource { }), ), } - - return resource } func resourceDataProtectionBackupVaultCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -158,22 +169,22 @@ func resourceDataProtectionBackupVaultCreateUpdate(d *pluginsdk.ResourceData, me return fmt.Errorf("expanding `identity`: %+v", err) } - datastoreType := backupvaults.StorageSettingStoreTypes(d.Get("datastore_type").(string)) - storageSettingType := backupvaults.StorageSettingTypes(d.Get("redundancy").(string)) - parameters := backupvaults.BackupVaultResource{ Location: pointer.To(location.Normalize(d.Get("location").(string))), Properties: backupvaults.BackupVault{ StorageSettings: []backupvaults.StorageSetting{ { - DatastoreType: &datastoreType, - Type: &storageSettingType, + DatastoreType: pointer.To(backupvaults.StorageSettingStoreTypes(d.Get("datastore_type").(string))), + Type: pointer.To(backupvaults.StorageSettingTypes(d.Get("redundancy").(string))), }, }, SecuritySettings: &backupvaults.SecuritySettings{ SoftDeleteSettings: &backupvaults.SoftDeleteSettings{ State: pointer.To(backupvaults.SoftDeleteState(d.Get("soft_delete").(string))), }, + ImmutabilitySettings: &backupvaults.ImmutabilitySettings{ + State: pointer.To(backupvaults.ImmutabilityState(d.Get("immutability").(string))), + }, }, }, Identity: expandedIdentity, @@ -229,16 +240,26 @@ func resourceDataProtectionBackupVaultRead(d *pluginsdk.ResourceData, meta inter if model := resp.Model; model != nil { d.Set("location", location.NormalizeNilable(model.Location)) props := model.Properties + if len(props.StorageSettings) > 0 { d.Set("datastore_type", string(pointer.From((props.StorageSettings)[0].DatastoreType))) d.Set("redundancy", string(pointer.From((props.StorageSettings)[0].Type))) } + + immutability := backupvaults.ImmutabilityStateDisabled if securitySetting := model.Properties.SecuritySettings; securitySetting != nil { + if immutabilitySettings := securitySetting.ImmutabilitySettings; immutabilitySettings != nil { + if immutabilitySettings.State != nil { + immutability = *immutabilitySettings.State + } + } if softDelete := securitySetting.SoftDeleteSettings; softDelete != nil { d.Set("soft_delete", string(pointer.From(softDelete.State))) d.Set("retention_duration_in_days", pointer.From(softDelete.RetentionDurationInDays)) } } + d.Set("immutability", string(immutability)) + crossRegionStoreEnabled := false if featureSetting := model.Properties.FeatureSettings; featureSetting != nil { if crossRegionRestore := featureSetting.CrossRegionRestoreSettings; crossRegionRestore != nil { @@ -247,7 +268,6 @@ func resourceDataProtectionBackupVaultRead(d *pluginsdk.ResourceData, meta inter } } } - d.Set("cross_region_restore_enabled", crossRegionStoreEnabled) if err = d.Set("identity", flattenBackupVaultDppIdentityDetails(model.Identity)); err != nil { diff --git a/internal/services/dataprotection/data_protection_backup_vault_resource_test.go b/internal/services/dataprotection/data_protection_backup_vault_resource_test.go index 061fde32fa7c..fee233165c12 100644 --- a/internal/services/dataprotection/data_protection_backup_vault_resource_test.go +++ b/internal/services/dataprotection/data_protection_backup_vault_resource_test.go @@ -241,11 +241,15 @@ resource "azurerm_data_protection_backup_vault" "test" { location = azurerm_resource_group.test.location datastore_type = "VaultStore" redundancy = "LocallyRedundant" + identity { type = "SystemAssigned" } + + immutability = "Disabled" soft_delete = "Off" retention_duration_in_days = 14 + tags = { ENV = "Test" } @@ -264,11 +268,15 @@ resource "azurerm_data_protection_backup_vault" "test" { location = azurerm_resource_group.test.location datastore_type = "VaultStore" redundancy = "LocallyRedundant" + identity { type = "SystemAssigned" } + + immutability = "Locked" soft_delete = "On" retention_duration_in_days = 15 + tags = { ENV = "Test" } @@ -287,6 +295,7 @@ resource "azurerm_data_protection_backup_vault" "test" { location = azurerm_resource_group.test.location datastore_type = "VaultStore" redundancy = "LocallyRedundant" + tags = { ENV = "Test" } diff --git a/internal/services/dynatrace/dynatrace_tag_rules_resource.go b/internal/services/dynatrace/dynatrace_tag_rules_resource.go index 777c44b718fb..1d045663b598 100644 --- a/internal/services/dynatrace/dynatrace_tag_rules_resource.go +++ b/internal/services/dynatrace/dynatrace_tag_rules_resource.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package dynatrace import ( diff --git a/internal/services/dynatrace/dynatrace_tag_rules_resource_test.go b/internal/services/dynatrace/dynatrace_tag_rules_resource_test.go index ed2c982ca8c0..33fea80e56ed 100644 --- a/internal/services/dynatrace/dynatrace_tag_rules_resource_test.go +++ b/internal/services/dynatrace/dynatrace_tag_rules_resource_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package dynatrace_test import ( diff --git a/internal/services/logic/logic_app_standard_resource.go b/internal/services/logic/logic_app_standard_resource.go index e59d70d6252d..7b1a44264c09 100644 --- a/internal/services/logic/logic_app_standard_resource.go +++ b/internal/services/logic/logic_app_standard_resource.go @@ -341,9 +341,9 @@ func resourceLogicAppStandardCreate(d *pluginsdk.ResourceData, meta interface{}) } publicNetworkAccess := d.Get("public_network_access").(string) - if !features.FivePointOhBeta() && publicNetworkAccess == "" { + if !features.FivePointOhBeta() { // if a user is still using `site_config.public_network_access_enabled` we should be setting `public_network_access` for them - publicNetworkAccess = helpers.PublicNetworkAccessEnabled + publicNetworkAccess = reconcilePNA(d) if v := siteEnvelope.Properties.SiteConfig.PublicNetworkAccess; v != nil && *v == helpers.PublicNetworkAccessDisabled { publicNetworkAccess = helpers.PublicNetworkAccessDisabled } @@ -379,6 +379,7 @@ func resourceLogicAppStandardCreate(d *pluginsdk.ResourceData, meta interface{}) } d.SetId(id.ID()) + return resourceLogicAppStandardUpdate(d, meta) } @@ -455,6 +456,10 @@ func resourceLogicAppStandardUpdate(d *pluginsdk.ResourceData, meta interface{}) } } + if !features.FivePointOhBeta() { // Until 5.0 the site_config value of this must be reflected back into the top-level property if not set there + siteConfig.PublicNetworkAccess = pointer.To(reconcilePNA(d)) + } + if clientCertEnabled { siteEnvelope.Properties.ClientCertMode = pointer.To(webapps.ClientCertMode(clientCertMode)) } @@ -484,7 +489,7 @@ func resourceLogicAppStandardUpdate(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("updating %s: %+v", *id, err) } - if d.HasChange("site_config") { // update siteConfig before appSettings in case the appSettings get covered by basicAppSettings + if d.HasChange("site_config") || (d.HasChange("public_network_access") && !features.FivePointOhBeta()) { // update siteConfig before appSettings in case the appSettings get covered by basicAppSettings siteConfigResource := webapps.SiteConfigResource{ Properties: &siteConfig, } @@ -1367,13 +1372,7 @@ func expandLogicAppStandardSiteConfig(d *pluginsdk.ResourceData) (webapps.SiteCo } if !features.FivePointOhBeta() { - if v, ok := config["public_network_access_enabled"]; ok { - pna := helpers.PublicNetworkAccessEnabled - if !v.(bool) { - pna = helpers.PublicNetworkAccessDisabled - } - siteConfig.PublicNetworkAccess = pointer.To(pna) - } + siteConfig.PublicNetworkAccess = pointer.To(reconcilePNA(d)) } return siteConfig, nil @@ -1555,3 +1554,26 @@ func expandHeaders(input interface{}) map[string][]string { return output } + +func reconcilePNA(d *pluginsdk.ResourceData) string { + pna := "" + scPNASet := true + if !d.GetRawConfig().AsValueMap()["public_network_access"].IsNull() { // is top level set, takes precedence + pna = d.Get("public_network_access").(string) + } + if sc := d.GetRawConfig().AsValueMap()["site_config"]; !sc.IsNull() { + if len(sc.AsValueSlice()) > 0 && !sc.AsValueSlice()[0].AsValueMap()["public_network_access_enabled"].IsNull() { + scPNASet = true + } + } + if pna == "" && scPNASet { // if not, or it's empty, is site_config value set + pnaBool := d.Get("site_config.0.public_network_access_enabled").(bool) + if pnaBool { + pna = helpers.PublicNetworkAccessEnabled + } else { + pna = helpers.PublicNetworkAccessDisabled + } + } + + return pna +} diff --git a/internal/services/logic/logic_app_standard_resource_test.go b/internal/services/logic/logic_app_standard_resource_test.go index d163f15597db..09495412701a 100644 --- a/internal/services/logic/logic_app_standard_resource_test.go +++ b/internal/services/logic/logic_app_standard_resource_test.go @@ -50,6 +50,8 @@ func TestAccLogicAppStandard_publicNetworkAccessDisabled(t *testing.T) { Config: r.publicNetworkAccess(data, "Disabled"), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("public_network_access").HasValue("Disabled"), + check.That(data.ResourceName).Key("site_config.0.public_network_access_enabled").HasValue("false"), ), }, data.ImportStep(), @@ -57,6 +59,17 @@ func TestAccLogicAppStandard_publicNetworkAccessDisabled(t *testing.T) { Config: r.publicNetworkAccess(data, "Enabled"), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("public_network_access").HasValue("Enabled"), + check.That(data.ResourceName).Key("site_config.0.public_network_access_enabled").HasValue("true"), + ), + }, + data.ImportStep(), + { + Config: r.publicNetworkAccess(data, "Disabled"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("public_network_access").HasValue("Disabled"), + check.That(data.ResourceName).Key("site_config.0.public_network_access_enabled").HasValue("false"), ), }, data.ImportStep(), diff --git a/internal/services/mssql/client/client.go b/internal/services/mssql/client/client.go index aacf1dd54117..6081e33d2cea 100644 --- a/internal/services/mssql/client/client.go +++ b/internal/services/mssql/client/client.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/geobackuppolicies" "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobagents" "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobcredentials" + "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs" "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/longtermretentionpolicies" "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/outboundfirewallrules" "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/replicationlinks" @@ -53,6 +54,7 @@ type Client struct { GeoBackupPoliciesClient *geobackuppolicies.GeoBackupPoliciesClient JobAgentsClient *jobagents.JobAgentsClient JobCredentialsClient *jobcredentials.JobCredentialsClient + JobsClient *jobs.JobsClient LongTermRetentionPoliciesClient *longtermretentionpolicies.LongTermRetentionPoliciesClient OutboundFirewallRulesClient *outboundfirewallrules.OutboundFirewallRulesClient ReplicationLinksClient *replicationlinks.ReplicationLinksClient @@ -148,6 +150,12 @@ func NewClient(o *common.ClientOptions) (*Client, error) { } o.Configure(jobCredentialsClient.Client, o.Authorizers.ResourceManager) + jobsClient, err := jobs.NewJobsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Jobs Client: %+v", err) + } + o.Configure(jobsClient.Client, o.Authorizers.ResourceManager) + longTermRetentionPoliciesClient, err := longtermretentionpolicies.NewLongTermRetentionPoliciesClientWithBaseURI(o.Environment.ResourceManager) if err != nil { return nil, fmt.Errorf("building Long Term Retention Policies Client: %+v", err) @@ -292,6 +300,7 @@ func NewClient(o *common.ClientOptions) (*Client, error) { DatabaseSecurityAlertPoliciesClient: databaseSecurityAlertPoliciesClient, ElasticPoolsClient: elasticPoolsClient, GeoBackupPoliciesClient: geoBackupPoliciesClient, + JobsClient: jobsClient, LongTermRetentionPoliciesClient: longTermRetentionPoliciesClient, ReplicationLinksClient: replicationLinksClient, RestorableDroppedDatabasesClient: restorableDroppedDatabasesClient, diff --git a/internal/services/mssql/mssql_database_resource.go b/internal/services/mssql/mssql_database_resource.go index cd0c6efec8a8..674d39ccbbe8 100644 --- a/internal/services/mssql/mssql_database_resource.go +++ b/internal/services/mssql/mssql_database_resource.go @@ -509,9 +509,9 @@ func resourceMsSqlDatabaseCreate(d *pluginsdk.ResourceData, meta interface{}) er state = transparentdataencryptions.TransparentDataEncryptionStateEnabled } - tde, err := transparentEncryptionClient.Get(ctx, id) - if err != nil { - return fmt.Errorf("while retrieving Transparent Data Encryption state for %s: %+v", id, err) + tde, retryErr := transparentEncryptionClient.Get(ctx, id) + if retryErr != nil { + return fmt.Errorf("while retrieving Transparent Data Encryption state for %s: %+v", id, retryErr) } currentState := transparentdataencryptions.TransparentDataEncryptionStateDisabled @@ -523,21 +523,21 @@ func resourceMsSqlDatabaseCreate(d *pluginsdk.ResourceData, meta interface{}) er // Submit TDE state only when state is being changed, otherwise it can cause unwanted detection of state changes from the cloud side if !strings.EqualFold(string(currentState), string(state)) { - input := transparentdataencryptions.LogicalDatabaseTransparentDataEncryption{ + tdePayload := transparentdataencryptions.LogicalDatabaseTransparentDataEncryption{ Properties: &transparentdataencryptions.TransparentDataEncryptionProperties{ State: state, }, } - if err := transparentEncryptionClient.CreateOrUpdateThenPoll(ctx, id, input); err != nil { + if err := transparentEncryptionClient.CreateOrUpdateThenPoll(ctx, id, tdePayload); err != nil { return fmt.Errorf("while enabling Transparent Data Encryption for %q: %+v", id.String(), err) } // NOTE: Internal x-ref, this is another case of hashicorp/go-azure-sdk#307 so this can be removed once that's fixed - if err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { - c, err := client.Get(ctx, id, databases.DefaultGetOperationOptions()) - if err != nil { - return pluginsdk.NonRetryableError(fmt.Errorf("while polling %s for status: %+v", id.String(), err)) + if retryErr = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { + c, err2 := client.Get(ctx, id, databases.DefaultGetOperationOptions()) + if err2 != nil { + return pluginsdk.NonRetryableError(fmt.Errorf("while polling %s for status: %+v", id.String(), err2)) } if c.Model != nil && c.Model.Properties != nil && c.Model.Properties.Status != nil { if c.Model.Properties.Status == pointer.To(databases.DatabaseStatusScaling) { @@ -548,8 +548,8 @@ func resourceMsSqlDatabaseCreate(d *pluginsdk.ResourceData, meta interface{}) er } return nil - }); err != nil { - return nil + }); retryErr != nil { + return retryErr } } else { log.Print("[DEBUG] Skipping re-writing of Transparent Data Encryption, since encryption state is not changing ...") @@ -597,7 +597,7 @@ func resourceMsSqlDatabaseCreate(d *pluginsdk.ResourceData, meta interface{}) er return nil }); err != nil { - return nil + return err } longTermRetentionPolicyProps := helper.ExpandLongTermRetentionPolicy(d.Get("long_term_retention_policy").([]interface{})) @@ -1001,7 +1001,7 @@ func resourceMsSqlDatabaseUpdate(d *pluginsdk.ResourceData, meta interface{}) er } return nil }); err != nil { - return nil + return err } } } @@ -1050,7 +1050,7 @@ func resourceMsSqlDatabaseUpdate(d *pluginsdk.ResourceData, meta interface{}) er return nil }); err != nil { - return nil + return err } if d.HasChange("long_term_retention_policy") { diff --git a/internal/services/mssql/mssql_job_resource.go b/internal/services/mssql/mssql_job_resource.go new file mode 100644 index 000000000000..44dcc0a7d580 --- /dev/null +++ b/internal/services/mssql/mssql_job_resource.go @@ -0,0 +1,192 @@ +package mssql + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type MsSqlJobResource struct{} + +type MsSqlJobResourceModel struct { + Name string `tfschema:"name"` + JobAgentID string `tfschema:"job_agent_id"` + Description string `tfschema:"description"` +} + +var _ sdk.ResourceWithUpdate = MsSqlJobResource{} + +func (MsSqlJobResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + ForceNew: true, + }, + "job_agent_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: jobs.ValidateJobAgentID, + ForceNew: true, + }, + "description": { + Type: pluginsdk.TypeString, + Optional: true, + }, + } +} + +func (MsSqlJobResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (MsSqlJobResource) ModelObject() interface{} { + return &MsSqlJobResourceModel{} +} + +func (MsSqlJobResource) ResourceType() string { + return "azurerm_mssql_job" +} + +func (r MsSqlJobResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MSSQL.JobsClient + + var model MsSqlJobResourceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + jobAgent, err := jobs.ParseJobAgentID(model.JobAgentID) + if err != nil { + return err + } + + id := jobs.NewJobID(jobAgent.SubscriptionId, jobAgent.ResourceGroupName, jobAgent.ServerName, jobAgent.JobAgentName, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + parameters := jobs.Job{ + Name: pointer.To(model.Name), + Properties: pointer.To(jobs.JobProperties{ + Description: pointer.To(model.Description), + }), + } + + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (MsSqlJobResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MSSQL.JobsClient + + id, err := jobs.ParseJobID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + state := MsSqlJobResourceModel{ + Name: id.JobName, + JobAgentID: jobs.NewJobAgentID(id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.JobAgentName).ID(), + } + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + state.Description = pointer.From(props.Description) + } + } + + return metadata.Encode(&state) + }, + } +} + +func (MsSqlJobResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MSSQL.JobsClient + + id, err := jobs.ParseJobID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var config MsSqlJobResourceModel + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + param := jobs.Job{ + Properties: pointer.To(jobs.JobProperties{ + Description: pointer.To(config.Description), + }), + } + + if _, err := client.CreateOrUpdate(ctx, *id, param); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return nil + }, + } +} + +func (MsSqlJobResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MSSQL.JobsClient + + id, err := jobs.ParseJobID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} + +func (MsSqlJobResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return jobs.ValidateJobID +} diff --git a/internal/services/mssql/mssql_job_resource_test.go b/internal/services/mssql/mssql_job_resource_test.go new file mode 100644 index 000000000000..c68260db18c0 --- /dev/null +++ b/internal/services/mssql/mssql_job_resource_test.go @@ -0,0 +1,166 @@ +package mssql_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type MsSqlJobResourceTest struct{} + +func TestAccMsSqlJobResource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mssql_job", "test") + r := MsSqlJobResourceTest{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMsSqlJobResource_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mssql_job", "test") + r := MsSqlJobResourceTest{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccMsSqlJobResource_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mssql_job", "test") + r := MsSqlJobResourceTest{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r)), + }, + data.ImportStep(), + }) +} + +func TestAccMsSqlJobResource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mssql_job", "test") + r := MsSqlJobResourceTest{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (MsSqlJobResourceTest) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := jobs.ParseJobID(state.ID) + if err != nil { + return nil, err + } + + resp, err := client.MSSQL.JobsClient.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func (r MsSqlJobResourceTest) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_mssql_job" "test" { + name = "acctest-job-%d" + job_agent_id = azurerm_mssql_job_agent.test.id +} +`, r.template(data), data.RandomInteger) +} + +func (r MsSqlJobResourceTest) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_mssql_job" "import" { + name = azurerm_mssql_job.test.name + job_agent_id = azurerm_mssql_job.test.job_agent_id +} +`, r.basic(data)) +} + +func (r MsSqlJobResourceTest) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_mssql_job" "test" { + name = "acctest-job-%d" + job_agent_id = azurerm_mssql_job_agent.test.id + + description = "Acctest Description" +} +`, r.template(data), data.RandomInteger) +} + +func (MsSqlJobResourceTest) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_mssql_server" "test" { + name = "acctest-server-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + version = "12.0" + administrator_login = "4dm1n157r470r" + administrator_login_password = "4-v3ry-53cr37-p455w0rd" +} + +resource "azurerm_mssql_database" "test" { + name = "acctest-db-%[1]d" + server_id = azurerm_mssql_server.test.id + collation = "SQL_Latin1_General_CP1_CI_AS" + sku_name = "S1" +} + +resource "azurerm_mssql_job_agent" "test" { + name = "acctest-job-agent-%[1]d" + location = azurerm_resource_group.test.location + database_id = azurerm_mssql_database.test.id +} +`, data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/mssql/mssql_job_schedule_resource.go b/internal/services/mssql/mssql_job_schedule_resource.go new file mode 100644 index 000000000000..0188622d1e78 --- /dev/null +++ b/internal/services/mssql/mssql_job_schedule_resource.go @@ -0,0 +1,329 @@ +package mssql + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs" + "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type MsSqlJobScheduleResource struct{} + +type MsSqlJobScheduleResourceModel struct { + JobID string `tfschema:"job_id"` + Type string `tfschema:"type"` + Enabled bool `tfschema:"enabled"` + EndTime string `tfschema:"end_time"` + Interval string `tfschema:"interval"` + StartTime string `tfschema:"start_time"` +} + +var ( + _ sdk.ResourceWithUpdate = MsSqlJobScheduleResource{} + _ sdk.ResourceWithCustomizeDiff = MsSqlJobScheduleResource{} +) + +func (MsSqlJobScheduleResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "job_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: jobs.ValidateJobID, + }, + "type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(jobs.PossibleValuesForJobScheduleType(), false), + }, + "enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + // Note: O+C the API sets this field to `false` if the schedule type is `Once` and the job has finished + Computed: true, + }, + "end_time": { + Type: pluginsdk.TypeString, + Optional: true, + // Note: O+C API sets and returns a default value if omitted + Computed: true, + DiffSuppressFunc: suppress.RFC3339MinuteTime, + ValidateFunc: validation.IsRFC3339Time, + }, + "interval": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validate.ISO8601Duration, + }, + "start_time": { + Type: pluginsdk.TypeString, + Optional: true, + // Note: O+C API sets and returns a default value if omitted + Computed: true, + DiffSuppressFunc: suppress.RFC3339MinuteTime, + ValidateFunc: validation.IsRFC3339Time, + }, + } +} + +func (MsSqlJobScheduleResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (MsSqlJobScheduleResource) CustomizeDiff() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 10 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var config MsSqlJobScheduleResourceModel + if err := metadata.DecodeDiff(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + if config.Type == string(jobs.JobScheduleTypeRecurring) && config.Interval == "" { + return fmt.Errorf("`interval` must be set when `type` is `Recurring`") + } + + return nil + }, + } +} + +func (MsSqlJobScheduleResource) ModelObject() interface{} { + return &MsSqlJobScheduleResourceModel{} +} + +func (MsSqlJobScheduleResource) ResourceType() string { + return "azurerm_mssql_job_schedule" +} + +func (r MsSqlJobScheduleResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MSSQL.JobsClient + + var config MsSqlJobScheduleResourceModel + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + jobId, err := jobs.ParseJobID(config.JobID) + if err != nil { + return err + } + + locks.ByID(jobId.ID()) + defer locks.UnlockByID(jobId.ID()) + + existing, err := client.Get(ctx, *jobId) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("%s was not found: %+v", jobId, err) + } + + return fmt.Errorf("checking for presence of existing %s: %+v", jobId, err) + } + + if existing.Model == nil { + return fmt.Errorf("retrieving %s: `model` was nil", jobId) + } + + if existing.Model.Properties == nil { + return fmt.Errorf("retrieving %s: `model.Properties` was nil", jobId) + } + + if existing.Model.Properties.Schedule == nil { + return fmt.Errorf("retrieving %s: `model.Properties.Schedule` was nil", jobId) + } + + // Default schedule is disabled when created using the API + // if schedule is enabled we can reasonably assume the schedule was modified outside of Terraform and should be imported. + schedule := existing.Model.Properties.Schedule + if pointer.From(schedule.Enabled) { + return metadata.ResourceRequiresImport(r.ResourceType(), jobId) + } + + schedule.Enabled = pointer.To(config.Enabled) + schedule.Type = pointer.To(jobs.JobScheduleType(config.Type)) + + if config.EndTime != "" { + schedule.EndTime = pointer.To(config.EndTime) + } + if config.Interval != "" && config.Type == string(jobs.JobScheduleTypeRecurring) { + schedule.Interval = pointer.To(config.Interval) + } + if config.StartTime != "" { + schedule.StartTime = pointer.To(config.StartTime) + } + + if _, err := client.CreateOrUpdate(ctx, *jobId, *existing.Model); err != nil { + return fmt.Errorf("creating schedule for %s: %+v", jobId, err) + } + + metadata.SetID(jobId) + return nil + }, + } +} + +func (MsSqlJobScheduleResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MSSQL.JobsClient + + jobId, err := jobs.ParseJobID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *jobId) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(jobId) + } + + return fmt.Errorf("retrieving %s: %+v", jobId, err) + } + + state := MsSqlJobScheduleResourceModel{ + JobID: jobId.ID(), + } + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + if schedule := props.Schedule; schedule != nil { + state.Enabled = pointer.From(schedule.Enabled) + state.EndTime = pointer.From(schedule.EndTime) + state.Interval = pointer.From(schedule.Interval) + state.StartTime = pointer.From(schedule.StartTime) + state.Type = string(pointer.From(schedule.Type)) + } + } + } + + return metadata.Encode(&state) + }, + } +} + +func (MsSqlJobScheduleResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MSSQL.JobsClient + + jobId, err := jobs.ParseJobID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + locks.ByID(jobId.ID()) + defer locks.UnlockByID(jobId.ID()) + + var config MsSqlJobScheduleResourceModel + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + existing, err := client.Get(ctx, *jobId) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", jobId, err) + } + + if existing.Model == nil { + return fmt.Errorf("retrieving %s: `model` was nil", jobId) + } + + if existing.Model.Properties == nil { + return fmt.Errorf("retrieving %s: `properties` was nil", jobId) + } + + if existing.Model.Properties.Schedule == nil { + return fmt.Errorf("retrieving %s: `schedule` was nil", jobId) + } + + schedule := existing.Model.Properties.Schedule + if metadata.ResourceData.HasChange("enabled") { + schedule.Enabled = pointer.To(config.Enabled) + } + + if metadata.ResourceData.HasChange("end_time") { + schedule.EndTime = pointer.To(config.EndTime) + } + + if metadata.ResourceData.HasChange("interval") { + schedule.Interval = pointer.To(config.Interval) + } + + if metadata.ResourceData.HasChange("start_time") { + schedule.StartTime = pointer.To(config.StartTime) + } + + if metadata.ResourceData.HasChange("type") { + schedule.Type = pointer.To(jobs.JobScheduleType(config.Type)) + } + + if _, err := client.CreateOrUpdate(ctx, *jobId, *existing.Model); err != nil { + return fmt.Errorf("updating schedule for %s: %+v", jobId, err) + } + + return nil + }, + } +} + +func (MsSqlJobScheduleResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MSSQL.JobsClient + + jobId, err := jobs.ParseJobID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + locks.ByID(jobId.ID()) + defer locks.UnlockByID(jobId.ID()) + + existing, err := client.Get(ctx, *jobId) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return nil + } + + return fmt.Errorf("retrieving %s: %+v", jobId, err) + } + + if model := existing.Model; model == nil { + return fmt.Errorf("retrieving %s: `model` was nil", jobId) + } + + if existing.Model.Properties == nil { + return fmt.Errorf("retrieving %s: `properties` was nil", jobId) + } + + // Set Schedule to nil allowing Azure to repopulate with default values + existing.Model.Properties.Schedule = nil + if _, err := client.CreateOrUpdate(ctx, *jobId, *existing.Model); err != nil { + return fmt.Errorf("deleting schedule from %s, %+v", jobId, err) + } + + return nil + }, + } +} + +func (MsSqlJobScheduleResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return jobs.ValidateJobID +} diff --git a/internal/services/mssql/mssql_job_schedule_resource_test.go b/internal/services/mssql/mssql_job_schedule_resource_test.go new file mode 100644 index 000000000000..d7541c9b8861 --- /dev/null +++ b/internal/services/mssql/mssql_job_schedule_resource_test.go @@ -0,0 +1,173 @@ +package mssql_test + +import ( + "context" + "fmt" + "regexp" + "testing" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type MsSqlJobScheduleResourceTest struct{} + +func TestAccMsSqlJobScheduleResource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mssql_job_schedule", "test") + r := MsSqlJobScheduleResourceTest{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("type").HasValue("Once"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMsSqlJobScheduleResource_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mssql_job_schedule", "test") + r := MsSqlJobScheduleResourceTest{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccMsSqlJobScheduleResource_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mssql_job_schedule", "test") + r := MsSqlJobScheduleResourceTest{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("type").HasValue("Once"), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("enabled").HasValue("true"), + check.That(data.ResourceName).Key("interval").HasValue("PT15M"), + check.That(data.ResourceName).Key("type").HasValue("Recurring"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMsSqlJobScheduleResource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mssql_job_schedule", "test") + r := MsSqlJobScheduleResourceTest{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("enabled").HasValue("true"), + check.That(data.ResourceName).Key("interval").HasValue("PT15M"), + check.That(data.ResourceName).Key("type").HasValue("Recurring"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMsSqlJobScheduleResource_recurringWithoutInterval(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mssql_job_schedule", "test") + r := MsSqlJobScheduleResourceTest{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.recurringWithoutInterval(data), + ExpectError: regexp.MustCompile("`interval` must be set when `type` is `Recurring`"), + }, + }) +} + +func (MsSqlJobScheduleResourceTest) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := jobs.ParseJobID(state.ID) + if err != nil { + return nil, err + } + + resp, err := client.MSSQL.JobsClient.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func (MsSqlJobScheduleResourceTest) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_mssql_job_schedule" "test" { + enabled = true + job_id = azurerm_mssql_job.test.id + type = "Once" +} +`, MsSqlJobResourceTest{}.basic(data)) +} + +func (r MsSqlJobScheduleResourceTest) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_mssql_job_schedule" "import" { + job_id = azurerm_mssql_job_schedule.test.job_id + type = azurerm_mssql_job_schedule.test.type +} +`, r.basic(data)) +} + +func (r MsSqlJobScheduleResourceTest) complete(data acceptance.TestData) string { + now := time.Now() + startTime := now.AddDate(0, 0, 5) + endTime := now.AddDate(0, 0, 10) + + return fmt.Sprintf(` +%s + +resource "azurerm_mssql_job_schedule" "test" { + enabled = true + end_time = "%[2]s" + interval = "PT15M" + job_id = azurerm_mssql_job.test.id + start_time = "%[3]s" + type = "Recurring" +} +`, MsSqlJobResourceTest{}.basic(data), endTime.Format(time.RFC3339), startTime.Format(time.RFC3339)) +} + +func (MsSqlJobScheduleResourceTest) recurringWithoutInterval(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_mssql_job_schedule" "test" { + enabled = true + job_id = azurerm_mssql_job.test.id + type = "Recurring" +} +`, MsSqlJobResourceTest{}.basic(data)) +} diff --git a/internal/services/mssql/registration.go b/internal/services/mssql/registration.go index ac1e8af1f096..1002919b011a 100644 --- a/internal/services/mssql/registration.go +++ b/internal/services/mssql/registration.go @@ -71,6 +71,8 @@ func (r Registration) DataSources() []sdk.DataSource { func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ MsSqlFailoverGroupResource{}, + MsSqlJobResource{}, + MsSqlJobScheduleResource{}, MsSqlVirtualMachineAvailabilityGroupListenerResource{}, MsSqlVirtualMachineGroupResource{}, ServerDNSAliasResource{}, diff --git a/internal/services/network/private_endpoint_resource.go b/internal/services/network/private_endpoint_resource.go index 9ab1f514c560..703e633960cd 100644 --- a/internal/services/network/private_endpoint_resource.go +++ b/internal/services/network/private_endpoint_resource.go @@ -665,7 +665,7 @@ func resourcePrivateEndpointRead(d *pluginsdk.ResourceData, meta interface{}) er for _, dnsZoneId := range *privateDnsZoneIds { flattened, err := retrieveAndFlattenPrivateDnsZone(ctx, dnsClient, dnsZoneId) if err != nil { - return nil + return fmt.Errorf("reading %s for %s: %+v", dnsZoneId, id, err) } // an exceptional case but no harm in handling diff --git a/internal/services/postgres/client/client.go b/internal/services/postgres/client/client.go index 7de68d1e4572..6380334415a1 100644 --- a/internal/services/postgres/client/client.go +++ b/internal/services/postgres/client/client.go @@ -17,11 +17,11 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys" flexibleserverconfigurations "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations" "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart" - flexibleserveradministrators "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators" - flexibleserverdatabases "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases" - flexibleserverfirewallrules "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules" flexibleservers "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/servers" - flexibleservervirtualendpoints "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints" + flexibleserveradministrators "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators" + flexibleserverdatabases "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases" + flexibleserverfirewallrules "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules" + flexibleservervirtualendpoints "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) diff --git a/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource.go b/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource.go index 2476db81beea..380cfb749be2 100644 --- a/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource.go +++ b/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" diff --git a/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource_test.go b/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource_test.go index bfa25103c24a..db580b23a498 100644 --- a/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource_test.go +++ b/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/postgres/postgresql_flexible_server_database_resource.go b/internal/services/postgres/postgresql_flexible_server_database_resource.go index 1eced17c3943..aa466ca96abb 100644 --- a/internal/services/postgres/postgresql_flexible_server_database_resource.go +++ b/internal/services/postgres/postgresql_flexible_server_database_resource.go @@ -9,7 +9,7 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" diff --git a/internal/services/postgres/postgresql_flexible_server_database_resource_test.go b/internal/services/postgres/postgresql_flexible_server_database_resource_test.go index 3a6494fdb1eb..edc9b97af7cf 100644 --- a/internal/services/postgres/postgresql_flexible_server_database_resource_test.go +++ b/internal/services/postgres/postgresql_flexible_server_database_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go b/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go index f6c129e7a923..eab96b6d9ea4 100644 --- a/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go +++ b/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go @@ -9,7 +9,7 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" diff --git a/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource_test.go b/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource_test.go index c1b904802ed7..c0b228de2f7c 100644 --- a/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource_test.go +++ b/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/postgres/postgresql_flexible_server_virtual_endpoint_resource.go b/internal/services/postgres/postgresql_flexible_server_virtual_endpoint_resource.go index c5ca00ab05bf..3e9767696a07 100644 --- a/internal/services/postgres/postgresql_flexible_server_virtual_endpoint_resource.go +++ b/internal/services/postgres/postgresql_flexible_server_virtual_endpoint_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/servers" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/internal/services/postgres/postgresql_flexible_server_virtual_endpoint_resource_test.go b/internal/services/postgres/postgresql_flexible_server_virtual_endpoint_resource_test.go index 1d2973e58f6c..89695f0ac79b 100644 --- a/internal/services/postgres/postgresql_flexible_server_virtual_endpoint_resource_test.go +++ b/internal/services/postgres/postgresql_flexible_server_virtual_endpoint_resource_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/redis/redis_cache_resource.go b/internal/services/redis/redis_cache_resource.go index 97330b5e0ccf..29c57a06b9ff 100644 --- a/internal/services/redis/redis_cache_resource.go +++ b/internal/services/redis/redis_cache_resource.go @@ -861,30 +861,28 @@ func expandRedisConfiguration(d *pluginsdk.ResourceData) (*redis.RedisCommonProp skuName := d.Get("sku_name").(string) if v := raw["maxclients"].(int); v > 0 { - output.Maxclients = utils.String(strconv.Itoa(v)) + output.Maxclients = pointer.To(strconv.Itoa(v)) } if d.Get("sku_name").(string) != string(redis.SkuNameBasic) { if v := raw["maxmemory_delta"].(int); v > 0 { - output.MaxmemoryDelta = utils.String(strconv.Itoa(v)) + output.MaxmemoryDelta = pointer.To(strconv.Itoa(v)) } if v := raw["maxmemory_reserved"].(int); v > 0 { - output.MaxmemoryReserved = utils.String(strconv.Itoa(v)) + output.MaxmemoryReserved = pointer.To(strconv.Itoa(v)) } if v := raw["maxfragmentationmemory_reserved"].(int); v > 0 { - output.MaxfragmentationmemoryReserved = utils.String(strconv.Itoa(v)) + output.MaxfragmentationmemoryReserved = pointer.To(strconv.Itoa(v)) } } if v := raw["maxmemory_policy"].(string); v != "" { - output.MaxmemoryPolicy = utils.String(v) + output.MaxmemoryPolicy = pointer.To(v) } - if v := raw["data_persistence_authentication_method"].(string); v != "" { - output.PreferredDataPersistenceAuthMethod = utils.String(v) - } + output.PreferredDataPersistenceAuthMethod = pointer.To(raw["data_persistence_authentication_method"].(string)) // AAD/Entra support // nolint : staticcheck diff --git a/internal/services/redis/redis_cache_resource_test.go b/internal/services/redis/redis_cache_resource_test.go index 2f70a53129e4..87e1911d9ac6 100644 --- a/internal/services/redis/redis_cache_resource_test.go +++ b/internal/services/redis/redis_cache_resource_test.go @@ -55,6 +55,36 @@ func TestAccRedisCache_managedIdentityAuth(t *testing.T) { }) } +func TestAccRedisCache_managedIdentityAuthDisable(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_redis_cache", "test") + r := RedisCacheResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.managedIdentityAuth(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("minimum_tls_version").Exists(), + check.That(data.ResourceName).Key("primary_connection_string").Exists(), + check.That(data.ResourceName).Key("secondary_connection_string").Exists(), + check.That(data.ResourceName).Key("redis_configuration.0.data_persistence_authentication_method").HasValue("ManagedIdentity"), + ), + }, + data.ImportStep(), + { + Config: r.managedIdentityAuthDisable(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("minimum_tls_version").Exists(), + check.That(data.ResourceName).Key("primary_connection_string").Exists(), + check.That(data.ResourceName).Key("secondary_connection_string").Exists(), + check.That(data.ResourceName).Key("redis_configuration.0.data_persistence_authentication_method").HasValue(""), + ), + }, + data.ImportStep(), + }) +} + func TestAccRedisCache_withoutSSL(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_redis_cache", "test") r := RedisCacheResource{} @@ -614,6 +644,32 @@ resource "azurerm_redis_cache" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, !requireSSL) } +func (RedisCacheResource) managedIdentityAuthDisable(data acceptance.TestData, requireSSL bool) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_redis_cache" "test" { + name = "acctestRedis-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + capacity = 1 + family = "C" + sku_name = "Basic" + non_ssl_port_enabled = %t + minimum_tls_version = "1.2" + + redis_configuration {} +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, !requireSSL) +} + func (RedisCacheResource) requiresImport(data acceptance.TestData) string { template := RedisCacheResource{}.basic(data, true) return fmt.Sprintf(` diff --git a/internal/services/redisenterprise/client/client.go b/internal/services/redisenterprise/client/client.go index 279dab257693..057cea361c93 100644 --- a/internal/services/redisenterprise/client/client.go +++ b/internal/services/redisenterprise/client/client.go @@ -6,8 +6,8 @@ package client import ( "fmt" - "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases" - "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) diff --git a/internal/services/redisenterprise/redis_enterprise_cluster_resource.go b/internal/services/redisenterprise/redis_enterprise_cluster_resource.go index 5ac98a61d0b1..757c2a8d3d41 100644 --- a/internal/services/redisenterprise/redis_enterprise_cluster_resource.go +++ b/internal/services/redisenterprise/redis_enterprise_cluster_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/features" diff --git a/internal/services/redisenterprise/redis_enterprise_cluster_resource_test.go b/internal/services/redisenterprise/redis_enterprise_cluster_resource_test.go index b7dc82716fc3..d59739dedaaf 100644 --- a/internal/services/redisenterprise/redis_enterprise_cluster_resource_test.go +++ b/internal/services/redisenterprise/redis_enterprise_cluster_resource_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/redisenterprise/redis_enterprise_database_data_source.go b/internal/services/redisenterprise/redis_enterprise_database_data_source.go index 80d0d7d4ad88..29c8724d031b 100644 --- a/internal/services/redisenterprise/redis_enterprise_database_data_source.go +++ b/internal/services/redisenterprise/redis_enterprise_database_data_source.go @@ -8,8 +8,8 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases" - "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/redisenterprise/redis_enterprise_database_resource.go b/internal/services/redisenterprise/redis_enterprise_database_resource.go index 5fe8717a0234..c39452aaf36a 100644 --- a/internal/services/redisenterprise/redis_enterprise_database_resource.go +++ b/internal/services/redisenterprise/redis_enterprise_database_resource.go @@ -11,8 +11,8 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases" - "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/validate" diff --git a/internal/services/redisenterprise/redis_enterprise_database_resource_test.go b/internal/services/redisenterprise/redis_enterprise_database_resource_test.go index 86d150e0b23d..cca8c3c760bc 100644 --- a/internal/services/redisenterprise/redis_enterprise_database_resource_test.go +++ b/internal/services/redisenterprise/redis_enterprise_database_resource_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/redisenterprise/validate/redis_enterprise_cluster_sku_name.go b/internal/services/redisenterprise/validate/redis_enterprise_cluster_sku_name.go index d59f321ea5e7..83c33ca97dcc 100644 --- a/internal/services/redisenterprise/validate/redis_enterprise_cluster_sku_name.go +++ b/internal/services/redisenterprise/validate/redis_enterprise_cluster_sku_name.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" ) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/credentialsets/model_credentialset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/credentialsets/model_credentialset.go index 26779ccad5c0..9258c25f35fc 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/credentialsets/model_credentialset.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/credentialsets/model_credentialset.go @@ -9,10 +9,10 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type CredentialSet struct { - Id *string `json:"id,omitempty"` - Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` - Name *string `json:"name,omitempty"` - Properties *CredentialSetProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CredentialSetProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/credentialsets/model_credentialsetupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/credentialsets/model_credentialsetupdateparameters.go index b43c63ad176e..14588433426b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/credentialsets/model_credentialsetupdateparameters.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/credentialsets/model_credentialsetupdateparameters.go @@ -8,6 +8,6 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type CredentialSetUpdateParameters struct { - Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` - Properties *CredentialSetUpdateProperties `json:"properties,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Properties *CredentialSetUpdateProperties `json:"properties,omitempty"` } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/README.md similarity index 94% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/README.md index 26b77d32729e..83bfb00d806c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators` Documentation -The `administrators` SDK allows for interaction with Azure Resource Manager `postgresql` (API Version `2022-12-01`). +The `administrators` SDK allows for interaction with Azure Resource Manager `postgresql` (API Version `2024-08-01`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). ### Import Path ```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators" +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/constants.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/constants.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/id_administrator.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/id_administrator.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/id_administrator.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/id_administrator.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/id_flexibleserver.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/id_flexibleserver.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/id_flexibleserver.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/method_create.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_create.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/method_create.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_listbyserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/method_listbyserver.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_listbyserver.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/method_listbyserver.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_activedirectoryadministrator.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/model_activedirectoryadministrator.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_activedirectoryadministrator.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/model_activedirectoryadministrator.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_activedirectoryadministratoradd.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/model_activedirectoryadministratoradd.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_activedirectoryadministratoradd.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/model_activedirectoryadministratoradd.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_administratorproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/model_administratorproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_administratorproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/model_administratorproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_administratorpropertiesforadd.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/model_administratorpropertiesforadd.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_administratorpropertiesforadd.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/model_administratorpropertiesforadd.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/version.go similarity index 68% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/version.go index 78aefc28eb70..f866ba24634b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators/version.go @@ -3,8 +3,8 @@ package administrators // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2022-12-01" +const defaultApiVersion = "2024-08-01" func userAgent() string { - return "hashicorp/go-azure-sdk/administrators/2022-12-01" + return "hashicorp/go-azure-sdk/administrators/2024-08-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/README.md similarity index 94% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/README.md index 9f1da5b91b30..32e6db658d45 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases` Documentation -The `databases` SDK allows for interaction with Azure Resource Manager `postgresql` (API Version `2022-12-01`). +The `databases` SDK allows for interaction with Azure Resource Manager `postgresql` (API Version `2024-08-01`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). ### Import Path ```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases" +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/id_database.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/id_database.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/id_database.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/id_flexibleserver.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/id_flexibleserver.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/id_flexibleserver.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/method_create.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_create.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/method_create.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_listbyserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/method_listbyserver.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_listbyserver.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/method_listbyserver.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/model_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/model_database.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/model_database.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/model_database.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/model_databaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/model_databaseproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/model_databaseproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/model_databaseproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/version.go similarity index 68% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/version.go index dc150c80b006..bcb1af1009b2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases/version.go @@ -3,8 +3,8 @@ package databases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2022-12-01" +const defaultApiVersion = "2024-08-01" func userAgent() string { - return "hashicorp/go-azure-sdk/databases/2022-12-01" + return "hashicorp/go-azure-sdk/databases/2024-08-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/README.md similarity index 94% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/README.md index 259c03d4f809..43527d8e1b98 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules` Documentation -The `firewallrules` SDK allows for interaction with Azure Resource Manager `postgresql` (API Version `2022-12-01`). +The `firewallrules` SDK allows for interaction with Azure Resource Manager `postgresql` (API Version `2024-08-01`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). ### Import Path ```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules" +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/id_firewallrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/id_firewallrule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/id_firewallrule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/id_firewallrule.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/id_flexibleserver.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/id_flexibleserver.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/id_flexibleserver.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/method_createorupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_createorupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/method_createorupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_listbyserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/method_listbyserver.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_listbyserver.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/method_listbyserver.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/model_firewallrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/model_firewallrule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/model_firewallrule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/model_firewallrule.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/model_firewallruleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/model_firewallruleproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/model_firewallruleproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/model_firewallruleproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/version.go similarity index 68% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/version.go index e34e91fb7239..d1bb00cf1ea4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules/version.go @@ -3,8 +3,8 @@ package firewallrules // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2022-12-01" +const defaultApiVersion = "2024-08-01" func userAgent() string { - return "hashicorp/go-azure-sdk/firewallrules/2022-12-01" + return "hashicorp/go-azure-sdk/firewallrules/2024-08-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/README.md similarity index 94% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/README.md index ef1573aa7fa1..7abc1ca8f6db 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints` Documentation -The `virtualendpoints` SDK allows for interaction with Azure Resource Manager `postgresql` (API Version `2023-06-01-preview`). +The `virtualendpoints` SDK allows for interaction with Azure Resource Manager `postgresql` (API Version `2024-08-01`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). ### Import Path ```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints" +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/constants.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/constants.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/id_flexibleserver.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_flexibleserver.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/id_flexibleserver.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_virtualendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/id_virtualendpoint.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_virtualendpoint.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/id_virtualendpoint.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/method_create.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/method_create.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/method_create.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/method_listbyserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/method_listbyserver.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/method_listbyserver.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/method_listbyserver.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/method_update.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/method_update.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/method_update.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/model_virtualendpointresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/model_virtualendpointresource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/model_virtualendpointresource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/model_virtualendpointresource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/model_virtualendpointresourceforpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/model_virtualendpointresourceforpatch.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/model_virtualendpointresourceforpatch.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/model_virtualendpointresourceforpatch.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/model_virtualendpointresourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/model_virtualendpointresourceproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/model_virtualendpointresourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/model_virtualendpointresourceproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/version.go similarity index 64% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/version.go index ae8e04490b95..e7bc0b24434c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints/version.go @@ -3,8 +3,8 @@ package virtualendpoints // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2023-06-01-preview" +const defaultApiVersion = "2024-08-01" func userAgent() string { - return "hashicorp/go-azure-sdk/virtualendpoints/2023-06-01-preview" + return "hashicorp/go-azure-sdk/virtualendpoints/2024-08-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/README.md similarity index 91% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/README.md index 5a538577fdc2..90651b539a28 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases` Documentation -The `databases` SDK allows for interaction with Azure Resource Manager `redisenterprise` (API Version `2024-10-01`). +The `databases` SDK allows for interaction with Azure Resource Manager `redisenterprise` (API Version `2024-06-01-preview`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). ### Import Path ```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases" +import "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases" ``` @@ -215,3 +215,15 @@ if err := client.UpdateThenPoll(ctx, id, payload); err != nil { // handle the error } ``` + + +### Example Usage: `DatabasesClient.UpgradeDBRedisVersion` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +if err := client.UpgradeDBRedisVersionThenPoll(ctx, id); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/constants.go similarity index 92% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/constants.go index e6c274c2c215..075ec0d43cd3 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/constants.go @@ -132,6 +132,47 @@ func parseClusteringPolicy(input string) (*ClusteringPolicy, error) { return &out, nil } +type DeferUpgradeSetting string + +const ( + DeferUpgradeSettingDeferred DeferUpgradeSetting = "Deferred" + DeferUpgradeSettingNotDeferred DeferUpgradeSetting = "NotDeferred" +) + +func PossibleValuesForDeferUpgradeSetting() []string { + return []string{ + string(DeferUpgradeSettingDeferred), + string(DeferUpgradeSettingNotDeferred), + } +} + +func (s *DeferUpgradeSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeferUpgradeSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeferUpgradeSetting(input string) (*DeferUpgradeSetting, error) { + vals := map[string]DeferUpgradeSetting{ + "deferred": DeferUpgradeSettingDeferred, + "notdeferred": DeferUpgradeSettingNotDeferred, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeferUpgradeSetting(input) + return &out, nil +} + type EvictionPolicy string const ( diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/id_database.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/id_database.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/id_database.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/id_redisenterprise.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/id_redisenterprise.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/id_redisenterprise.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/id_redisenterprise.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_create.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_create.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_create.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_export.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_export.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_export.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_export.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_flush.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_flush.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_flush.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_flush.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_forcelinktoreplicationgroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_forcelinktoreplicationgroup.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_forcelinktoreplicationgroup.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_forcelinktoreplicationgroup.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_forceunlink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_forceunlink.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_forceunlink.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_forceunlink.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_import.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_import.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_import.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_import.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_listbycluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_listbycluster.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_listbycluster.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_listbycluster.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_listkeys.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_listkeys.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_listkeys.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_listkeys.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_regeneratekey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_regeneratekey.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_regeneratekey.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_regeneratekey.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_update.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/method_update.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_update.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_upgradedbredisversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_upgradedbredisversion.go new file mode 100644 index 000000000000..ad7e756b1dc4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/method_upgradedbredisversion.go @@ -0,0 +1,69 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeDBRedisVersionOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// UpgradeDBRedisVersion ... +func (c DatabasesClient) UpgradeDBRedisVersion(ctx context.Context, id DatabaseId) (result UpgradeDBRedisVersionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/upgradeDBRedisVersion", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpgradeDBRedisVersionThenPoll performs UpgradeDBRedisVersion then polls until it's completed +func (c DatabasesClient) UpgradeDBRedisVersionThenPoll(ctx context.Context, id DatabaseId) error { + result, err := c.UpgradeDBRedisVersion(ctx, id) + if err != nil { + return fmt.Errorf("performing UpgradeDBRedisVersion: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpgradeDBRedisVersion: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_accesskeys.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_accesskeys.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_accesskeys.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_accesskeys.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_database.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_database.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_database.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_databaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_databaseproperties.go similarity index 85% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_databaseproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_databaseproperties.go index 85d805064ef7..09bde8edb557 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_databaseproperties.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_databaseproperties.go @@ -6,11 +6,13 @@ package databases type DatabaseProperties struct { ClientProtocol *Protocol `json:"clientProtocol,omitempty"` ClusteringPolicy *ClusteringPolicy `json:"clusteringPolicy,omitempty"` + DeferUpgrade *DeferUpgradeSetting `json:"deferUpgrade,omitempty"` EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"` GeoReplication *DatabasePropertiesGeoReplication `json:"geoReplication,omitempty"` Modules *[]Module `json:"modules,omitempty"` Persistence *Persistence `json:"persistence,omitempty"` Port *int64 `json:"port,omitempty"` ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` ResourceState *ResourceState `json:"resourceState,omitempty"` } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_databasepropertiesgeoreplication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_databasepropertiesgeoreplication.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_databasepropertiesgeoreplication.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_databasepropertiesgeoreplication.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_databaseupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_databaseupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_databaseupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_databaseupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_exportclusterparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_exportclusterparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_exportclusterparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_exportclusterparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_flushparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_flushparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_flushparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_flushparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_forcelinkparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_forcelinkparameters.go similarity index 64% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_forcelinkparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_forcelinkparameters.go index 7c8c1ecd0124..8d9d8518ad16 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_forcelinkparameters.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_forcelinkparameters.go @@ -4,6 +4,5 @@ package databases // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ForceLinkParameters struct { - GroupNickname string `json:"groupNickname"` - LinkedDatabases []LinkedDatabase `json:"linkedDatabases"` + GeoReplication ForceLinkParametersGeoReplication `json:"geoReplication"` } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_forcelinkparametersgeoreplication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_forcelinkparametersgeoreplication.go new file mode 100644 index 000000000000..89772649f897 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_forcelinkparametersgeoreplication.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceLinkParametersGeoReplication struct { + GroupNickname *string `json:"groupNickname,omitempty"` + LinkedDatabases *[]LinkedDatabase `json:"linkedDatabases,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_forceunlinkparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_forceunlinkparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_forceunlinkparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_forceunlinkparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_importclusterparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_importclusterparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_importclusterparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_importclusterparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_linkeddatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_linkeddatabase.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_linkeddatabase.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_linkeddatabase.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_module.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_module.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_module.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_module.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_persistence.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_persistence.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_persistence.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_persistence.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_regeneratekeyparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_regeneratekeyparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/model_regeneratekeyparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/model_regeneratekeyparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/version.go similarity index 65% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/version.go index 53706fab4719..93eecd011fc4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases/version.go @@ -3,8 +3,8 @@ package databases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2024-10-01" +const defaultApiVersion = "2024-06-01-preview" func userAgent() string { - return "hashicorp/go-azure-sdk/databases/2024-10-01" + return "hashicorp/go-azure-sdk/databases/2024-06-01-preview" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/README.md similarity index 93% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/README.md index 03f63dadefd1..54800f2cd750 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/README.md @@ -1,7 +1,7 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise` Documentation -The `redisenterprise` SDK allows for interaction with Azure Resource Manager `redisenterprise` (API Version `2024-10-01`). +The `redisenterprise` SDK allows for interaction with Azure Resource Manager `redisenterprise` (API Version `2024-06-01-preview`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). @@ -9,7 +9,7 @@ This readme covers example usages, but further information on [using this SDK ca ```go import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -import "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise" +import "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise" ``` @@ -235,6 +235,18 @@ if err := client.DatabasesUpdateThenPoll(ctx, id, payload); err != nil { ``` +### Example Usage: `RedisEnterpriseClient.DatabasesUpgradeDBRedisVersion` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +if err := client.DatabasesUpgradeDBRedisVersionThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + ### Example Usage: `RedisEnterpriseClient.Delete` ```go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/constants.go similarity index 94% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/constants.go index d9ac97ee81a3..79e57ef39a2d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/constants.go @@ -173,6 +173,47 @@ func parseCmkIdentityType(input string) (*CmkIdentityType, error) { return &out, nil } +type DeferUpgradeSetting string + +const ( + DeferUpgradeSettingDeferred DeferUpgradeSetting = "Deferred" + DeferUpgradeSettingNotDeferred DeferUpgradeSetting = "NotDeferred" +) + +func PossibleValuesForDeferUpgradeSetting() []string { + return []string{ + string(DeferUpgradeSettingDeferred), + string(DeferUpgradeSettingNotDeferred), + } +} + +func (s *DeferUpgradeSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeferUpgradeSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeferUpgradeSetting(input string) (*DeferUpgradeSetting, error) { + vals := map[string]DeferUpgradeSetting{ + "deferred": DeferUpgradeSettingDeferred, + "notdeferred": DeferUpgradeSettingNotDeferred, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeferUpgradeSetting(input) + return &out, nil +} + type EvictionPolicy string const ( @@ -593,11 +634,9 @@ type SkuName string const ( SkuNameEnterpriseEFive SkuName = "Enterprise_E5" SkuNameEnterpriseEFiveZero SkuName = "Enterprise_E50" - SkuNameEnterpriseEFourHundred SkuName = "Enterprise_E400" SkuNameEnterpriseEOne SkuName = "Enterprise_E1" SkuNameEnterpriseEOneHundred SkuName = "Enterprise_E100" SkuNameEnterpriseEOneZero SkuName = "Enterprise_E10" - SkuNameEnterpriseETwoHundred SkuName = "Enterprise_E200" SkuNameEnterpriseETwoZero SkuName = "Enterprise_E20" SkuNameEnterpriseFlashFOneFiveHundred SkuName = "EnterpriseFlash_F1500" SkuNameEnterpriseFlashFSevenHundred SkuName = "EnterpriseFlash_F700" @@ -608,11 +647,9 @@ func PossibleValuesForSkuName() []string { return []string{ string(SkuNameEnterpriseEFive), string(SkuNameEnterpriseEFiveZero), - string(SkuNameEnterpriseEFourHundred), string(SkuNameEnterpriseEOne), string(SkuNameEnterpriseEOneHundred), string(SkuNameEnterpriseEOneZero), - string(SkuNameEnterpriseETwoHundred), string(SkuNameEnterpriseETwoZero), string(SkuNameEnterpriseFlashFOneFiveHundred), string(SkuNameEnterpriseFlashFSevenHundred), @@ -637,11 +674,9 @@ func parseSkuName(input string) (*SkuName, error) { vals := map[string]SkuName{ "enterprise_e5": SkuNameEnterpriseEFive, "enterprise_e50": SkuNameEnterpriseEFiveZero, - "enterprise_e400": SkuNameEnterpriseEFourHundred, "enterprise_e1": SkuNameEnterpriseEOne, "enterprise_e100": SkuNameEnterpriseEOneHundred, "enterprise_e10": SkuNameEnterpriseEOneZero, - "enterprise_e200": SkuNameEnterpriseETwoHundred, "enterprise_e20": SkuNameEnterpriseETwoZero, "enterpriseflash_f1500": SkuNameEnterpriseFlashFOneFiveHundred, "enterpriseflash_f700": SkuNameEnterpriseFlashFSevenHundred, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/id_database.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/id_database.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/id_database.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/id_redisenterprise.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/id_redisenterprise.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/id_redisenterprise.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/id_redisenterprise.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_create.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_create.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_create.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasescreate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasescreate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasescreate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasescreate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesdelete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesdelete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesdelete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesexport.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesexport.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesexport.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesexport.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesflush.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesflush.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesflush.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesflush.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesforcelinktoreplicationgroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesforcelinktoreplicationgroup.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesforcelinktoreplicationgroup.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesforcelinktoreplicationgroup.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesforceunlink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesforceunlink.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesforceunlink.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesforceunlink.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesget.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesget.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesget.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesimport.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesimport.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesimport.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesimport.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databaseslistbycluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databaseslistbycluster.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databaseslistbycluster.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databaseslistbycluster.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databaseslistkeys.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databaseslistkeys.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databaseslistkeys.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databaseslistkeys.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesregeneratekey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesregeneratekey.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesregeneratekey.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesregeneratekey.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_databasesupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesupgradedbredisversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesupgradedbredisversion.go new file mode 100644 index 000000000000..5c3e29659aca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_databasesupgradedbredisversion.go @@ -0,0 +1,69 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesUpgradeDBRedisVersionOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DatabasesUpgradeDBRedisVersion ... +func (c RedisEnterpriseClient) DatabasesUpgradeDBRedisVersion(ctx context.Context, id DatabaseId) (result DatabasesUpgradeDBRedisVersionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/upgradeDBRedisVersion", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DatabasesUpgradeDBRedisVersionThenPoll performs DatabasesUpgradeDBRedisVersion then polls until it's completed +func (c RedisEnterpriseClient) DatabasesUpgradeDBRedisVersionThenPoll(ctx context.Context, id DatabaseId) error { + result, err := c.DatabasesUpgradeDBRedisVersion(ctx, id) + if err != nil { + return fmt.Errorf("performing DatabasesUpgradeDBRedisVersion: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DatabasesUpgradeDBRedisVersion: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_list.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_list.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_list.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_listbyresourcegroup.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_listbyresourcegroup.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_listbyresourcegroup.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_update.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/method_update.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/method_update.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_accesskeys.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_accesskeys.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_accesskeys.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_accesskeys.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_cluster.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_cluster.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_cluster.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_clusterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_clusterproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_clusterproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_clusterproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_clusterpropertiesencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_clusterpropertiesencryption.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_clusterpropertiesencryption.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_clusterpropertiesencryption.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_clusterpropertiesencryptioncustomermanagedkeyencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_clusterpropertiesencryptioncustomermanagedkeyencryption.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_clusterpropertiesencryptioncustomermanagedkeyencryption.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_clusterpropertiesencryptioncustomermanagedkeyencryption.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_clusterpropertiesencryptioncustomermanagedkeyencryptionkeyencryptionkeyidentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_clusterpropertiesencryptioncustomermanagedkeyencryptionkeyencryptionkeyidentity.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_clusterpropertiesencryptioncustomermanagedkeyencryptionkeyencryptionkeyidentity.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_clusterpropertiesencryptioncustomermanagedkeyencryptionkeyencryptionkeyidentity.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_clusterupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_clusterupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_clusterupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_clusterupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_database.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_database.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_database.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_databaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_databaseproperties.go similarity index 85% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_databaseproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_databaseproperties.go index c8ca12b1385e..2b5cfe11a8b6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_databaseproperties.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_databaseproperties.go @@ -6,11 +6,13 @@ package redisenterprise type DatabaseProperties struct { ClientProtocol *Protocol `json:"clientProtocol,omitempty"` ClusteringPolicy *ClusteringPolicy `json:"clusteringPolicy,omitempty"` + DeferUpgrade *DeferUpgradeSetting `json:"deferUpgrade,omitempty"` EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"` GeoReplication *DatabasePropertiesGeoReplication `json:"geoReplication,omitempty"` Modules *[]Module `json:"modules,omitempty"` Persistence *Persistence `json:"persistence,omitempty"` Port *int64 `json:"port,omitempty"` ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` ResourceState *ResourceState `json:"resourceState,omitempty"` } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_databasepropertiesgeoreplication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_databasepropertiesgeoreplication.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_databasepropertiesgeoreplication.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_databasepropertiesgeoreplication.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_databaseupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_databaseupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_databaseupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_databaseupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_exportclusterparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_exportclusterparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_exportclusterparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_exportclusterparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_flushparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_flushparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_flushparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_flushparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_forcelinkparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_forcelinkparameters.go similarity index 65% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_forcelinkparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_forcelinkparameters.go index 32ca00618d37..b80b6aaf76b7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_forcelinkparameters.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_forcelinkparameters.go @@ -4,6 +4,5 @@ package redisenterprise // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ForceLinkParameters struct { - GroupNickname string `json:"groupNickname"` - LinkedDatabases []LinkedDatabase `json:"linkedDatabases"` + GeoReplication ForceLinkParametersGeoReplication `json:"geoReplication"` } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_forcelinkparametersgeoreplication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_forcelinkparametersgeoreplication.go new file mode 100644 index 000000000000..53242cf971bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_forcelinkparametersgeoreplication.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceLinkParametersGeoReplication struct { + GroupNickname *string `json:"groupNickname,omitempty"` + LinkedDatabases *[]LinkedDatabase `json:"linkedDatabases,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_forceunlinkparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_forceunlinkparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_forceunlinkparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_forceunlinkparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_importclusterparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_importclusterparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_importclusterparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_importclusterparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_linkeddatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_linkeddatabase.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_linkeddatabase.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_linkeddatabase.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_module.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_module.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_module.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_module.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_persistence.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_persistence.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_persistence.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_persistence.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_privateendpoint.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_privateendpoint.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_privateendpoint.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_privateendpointconnection.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_privateendpointconnection.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_privateendpointconnection.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_privateendpointconnectionproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_privateendpointconnectionproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_privateendpointconnectionproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_privatelinkserviceconnectionstate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_privatelinkserviceconnectionstate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_privatelinkserviceconnectionstate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_regeneratekeyparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_regeneratekeyparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_regeneratekeyparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_regeneratekeyparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_sku.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/model_sku.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/model_sku.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/version.go similarity index 64% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/version.go index dce3600f7165..d9e44a1872cf 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise/version.go @@ -3,8 +3,8 @@ package redisenterprise // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2024-10-01" +const defaultApiVersion = "2024-06-01-preview" func userAgent() string { - return "hashicorp/go-azure-sdk/redisenterprise/2024-10-01" + return "hashicorp/go-azure-sdk/redisenterprise/2024-06-01-preview" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/README.md new file mode 100644 index 000000000000..9b6b9185571c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs` Documentation + +The `jobs` SDK allows for interaction with Azure Resource Manager `sql` (API Version `2023-08-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs" +``` + + +### Client Initialization + +```go +client := jobs.NewJobsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `JobsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := jobs.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverName", "jobAgentName", "jobName") + +payload := jobs.Job{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `JobsClient.Delete` + +```go +ctx := context.TODO() +id := jobs.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverName", "jobAgentName", "jobName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `JobsClient.Get` + +```go +ctx := context.TODO() +id := jobs.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverName", "jobAgentName", "jobName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `JobsClient.ListByAgent` + +```go +ctx := context.TODO() +id := jobs.NewJobAgentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverName", "jobAgentName") + +// alternatively `client.ListByAgent(ctx, id)` can be used to do batched pagination +items, err := client.ListByAgentComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/client.go new file mode 100644 index 000000000000..762c577e9e18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/client.go @@ -0,0 +1,26 @@ +package jobs + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JobsClient struct { + Client *resourcemanager.Client +} + +func NewJobsClientWithBaseURI(sdkApi sdkEnv.Api) (*JobsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "jobs", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating JobsClient: %+v", err) + } + + return &JobsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/constants.go new file mode 100644 index 000000000000..2021912af6bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/constants.go @@ -0,0 +1,51 @@ +package jobs + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JobScheduleType string + +const ( + JobScheduleTypeOnce JobScheduleType = "Once" + JobScheduleTypeRecurring JobScheduleType = "Recurring" +) + +func PossibleValuesForJobScheduleType() []string { + return []string{ + string(JobScheduleTypeOnce), + string(JobScheduleTypeRecurring), + } +} + +func (s *JobScheduleType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseJobScheduleType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseJobScheduleType(input string) (*JobScheduleType, error) { + vals := map[string]JobScheduleType{ + "once": JobScheduleTypeOnce, + "recurring": JobScheduleTypeRecurring, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := JobScheduleType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/id_job.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/id_job.go new file mode 100644 index 000000000000..2ec039e7952d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/id_job.go @@ -0,0 +1,148 @@ +package jobs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&JobId{}) +} + +var _ resourceids.ResourceId = &JobId{} + +// JobId is a struct representing the Resource ID for a Job +type JobId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + JobAgentName string + JobName string +} + +// NewJobID returns a new JobId struct +func NewJobID(subscriptionId string, resourceGroupName string, serverName string, jobAgentName string, jobName string) JobId { + return JobId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + JobAgentName: jobAgentName, + JobName: jobName, + } +} + +// ParseJobID parses 'input' into a JobId +func ParseJobID(input string) (*JobId, error) { + parser := resourceids.NewParserFromResourceIdType(&JobId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := JobId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseJobIDInsensitively parses 'input' case-insensitively into a JobId +// note: this method should only be used for API response data and not user input +func ParseJobIDInsensitively(input string) (*JobId, error) { + parser := resourceids.NewParserFromResourceIdType(&JobId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := JobId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) + } + + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) + } + + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) + } + + return nil +} + +// ValidateJobID checks that 'input' can be parsed as a Job ID +func ValidateJobID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseJobID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Job ID +func (id JobId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Sql/servers/%s/jobAgents/%s/jobs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.JobAgentName, id.JobName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Job ID +func (id JobId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSql", "Microsoft.Sql", "Microsoft.Sql"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverName"), + resourceids.StaticSegment("staticJobAgents", "jobAgents", "jobAgents"), + resourceids.UserSpecifiedSegment("jobAgentName", "jobAgentName"), + resourceids.StaticSegment("staticJobs", "jobs", "jobs"), + resourceids.UserSpecifiedSegment("jobName", "jobName"), + } +} + +// String returns a human-readable description of this Job ID +func (id JobId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Job Agent Name: %q", id.JobAgentName), + fmt.Sprintf("Job Name: %q", id.JobName), + } + return fmt.Sprintf("Job (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/id_jobagent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/id_jobagent.go new file mode 100644 index 000000000000..bdefa8a6d22b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/id_jobagent.go @@ -0,0 +1,139 @@ +package jobs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&JobAgentId{}) +} + +var _ resourceids.ResourceId = &JobAgentId{} + +// JobAgentId is a struct representing the Resource ID for a Job Agent +type JobAgentId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + JobAgentName string +} + +// NewJobAgentID returns a new JobAgentId struct +func NewJobAgentID(subscriptionId string, resourceGroupName string, serverName string, jobAgentName string) JobAgentId { + return JobAgentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + JobAgentName: jobAgentName, + } +} + +// ParseJobAgentID parses 'input' into a JobAgentId +func ParseJobAgentID(input string) (*JobAgentId, error) { + parser := resourceids.NewParserFromResourceIdType(&JobAgentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := JobAgentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseJobAgentIDInsensitively parses 'input' case-insensitively into a JobAgentId +// note: this method should only be used for API response data and not user input +func ParseJobAgentIDInsensitively(input string) (*JobAgentId, error) { + parser := resourceids.NewParserFromResourceIdType(&JobAgentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := JobAgentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) + } + + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) + } + + return nil +} + +// ValidateJobAgentID checks that 'input' can be parsed as a Job Agent ID +func ValidateJobAgentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseJobAgentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Job Agent ID +func (id JobAgentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Sql/servers/%s/jobAgents/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.JobAgentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Job Agent ID +func (id JobAgentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSql", "Microsoft.Sql", "Microsoft.Sql"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverName"), + resourceids.StaticSegment("staticJobAgents", "jobAgents", "jobAgents"), + resourceids.UserSpecifiedSegment("jobAgentName", "jobAgentName"), + } +} + +// String returns a human-readable description of this Job Agent ID +func (id JobAgentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Job Agent Name: %q", id.JobAgentName), + } + return fmt.Sprintf("Job Agent (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_createorupdate.go new file mode 100644 index 000000000000..f3c623fcd532 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_createorupdate.go @@ -0,0 +1,58 @@ +package jobs + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Job +} + +// CreateOrUpdate ... +func (c JobsClient) CreateOrUpdate(ctx context.Context, id JobId, input Job) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Job + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_delete.go new file mode 100644 index 000000000000..4e65e20fc820 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_delete.go @@ -0,0 +1,47 @@ +package jobs + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c JobsClient) Delete(ctx context.Context, id JobId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_get.go new file mode 100644 index 000000000000..92dd9e2cf394 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_get.go @@ -0,0 +1,53 @@ +package jobs + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Job +} + +// Get ... +func (c JobsClient) Get(ctx context.Context, id JobId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Job + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_listbyagent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_listbyagent.go new file mode 100644 index 000000000000..ae393a334fae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/method_listbyagent.go @@ -0,0 +1,105 @@ +package jobs + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByAgentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Job +} + +type ListByAgentCompleteResult struct { + LatestHttpResponse *http.Response + Items []Job +} + +type ListByAgentCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByAgentCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByAgent ... +func (c JobsClient) ListByAgent(ctx context.Context, id JobAgentId) (result ListByAgentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByAgentCustomPager{}, + Path: fmt.Sprintf("%s/jobs", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Job `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByAgentComplete retrieves all the results into a single object +func (c JobsClient) ListByAgentComplete(ctx context.Context, id JobAgentId) (ListByAgentCompleteResult, error) { + return c.ListByAgentCompleteMatchingPredicate(ctx, id, JobOperationPredicate{}) +} + +// ListByAgentCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c JobsClient) ListByAgentCompleteMatchingPredicate(ctx context.Context, id JobAgentId, predicate JobOperationPredicate) (result ListByAgentCompleteResult, err error) { + items := make([]Job, 0) + + resp, err := c.ListByAgent(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByAgentCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/model_job.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/model_job.go new file mode 100644 index 000000000000..ec2235381d89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/model_job.go @@ -0,0 +1,11 @@ +package jobs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Job struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *JobProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/model_jobproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/model_jobproperties.go new file mode 100644 index 000000000000..bf61507564be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/model_jobproperties.go @@ -0,0 +1,10 @@ +package jobs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JobProperties struct { + Description *string `json:"description,omitempty"` + Schedule *JobSchedule `json:"schedule,omitempty"` + Version *int64 `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/model_jobschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/model_jobschedule.go new file mode 100644 index 000000000000..dda50f7119d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/model_jobschedule.go @@ -0,0 +1,42 @@ +package jobs + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JobSchedule struct { + Enabled *bool `json:"enabled,omitempty"` + EndTime *string `json:"endTime,omitempty"` + Interval *string `json:"interval,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Type *JobScheduleType `json:"type,omitempty"` +} + +func (o *JobSchedule) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *JobSchedule) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *JobSchedule) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *JobSchedule) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/predicates.go new file mode 100644 index 000000000000..8326102dc52c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/predicates.go @@ -0,0 +1,27 @@ +package jobs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JobOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p JobOperationPredicate) Matches(input Job) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/version.go new file mode 100644 index 000000000000..ce6ca6ed5fb3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs/version.go @@ -0,0 +1,10 @@ +package jobs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-08-01-preview" + +func userAgent() string { + return "hashicorp/go-azure-sdk/jobs/2023-08-01-preview" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go index d77e8afaf4d9..a52e5dad6640 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go @@ -622,7 +622,7 @@ func (c *Client) ExecutePaged(ctx context.Context, req *Request) (*Response, err return resp, err } } - if nextLink == nil { + if nextLink == nil || string(*nextLink) == "" { // This is the last page return resp, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 5f76a6e74d8e..3f04b5497440 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -148,7 +148,7 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/tags github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk/resource-manager v0.20241212.1154051 +# github.com/hashicorp/go-azure-sdk/resource-manager v0.20250115.1141151 ## explicit; go 1.22 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview @@ -943,11 +943,11 @@ github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtual github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart -github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators -github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases -github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/servers -github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2023-06-01-preview/virtualendpoints +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/administrators +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/databases +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/firewallrules +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2024-08-01/virtualendpoints github.com/hashicorp/go-azure-sdk/resource-manager/postgresqlhsc/2022-11-08/clusters github.com/hashicorp/go-azure-sdk/resource-manager/postgresqlhsc/2022-11-08/configurations github.com/hashicorp/go-azure-sdk/resource-manager/postgresqlhsc/2022-11-08/firewallrules @@ -984,8 +984,8 @@ github.com/hashicorp/go-azure-sdk/resource-manager/redis/2024-03-01/patchschedul github.com/hashicorp/go-azure-sdk/resource-manager/redis/2024-03-01/privateendpointconnections github.com/hashicorp/go-azure-sdk/resource-manager/redis/2024-03-01/privatelinkresources github.com/hashicorp/go-azure-sdk/resource-manager/redis/2024-03-01/redis -github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/databases -github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-10-01/redisenterprise +github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/databases +github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2024-06-01-preview/redisenterprise github.com/hashicorp/go-azure-sdk/resource-manager/relay/2021-11-01/hybridconnections github.com/hashicorp/go-azure-sdk/resource-manager/relay/2021-11-01/namespaces github.com/hashicorp/go-azure-sdk/resource-manager/resourceconnector/2022-10-27/appliances @@ -1049,6 +1049,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/geobac github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/instancefailovergroups github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobagents github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobcredentials +github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobs github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/longtermretentionpolicies github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/managedbackupshorttermretentionpolicies github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/manageddatabases @@ -1164,7 +1165,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplands github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances -# github.com/hashicorp/go-azure-sdk/sdk v0.20241212.1154051 +# github.com/hashicorp/go-azure-sdk/sdk v0.20250115.1141151 ## explicit; go 1.22 github.com/hashicorp/go-azure-sdk/sdk/auth github.com/hashicorp/go-azure-sdk/sdk/auth/autorest diff --git a/website/docs/d/container_app.html.markdown b/website/docs/d/container_app.html.markdown index e1ae9f0227c9..8ac04e0967f0 100644 --- a/website/docs/d/container_app.html.markdown +++ b/website/docs/d/container_app.html.markdown @@ -79,6 +79,8 @@ A `template` block supports the following: * `revision_suffix` - The suffix for the revision. This value must be unique for the lifetime of the Resource. If omitted the service will use a hash function to create one. +* `termination_grace_period_seconds` - The time in seconds after the container is sent the termination signal before the process if forcibly killed. + * `volume` - A `volume` block as detailed below. --- diff --git a/website/docs/r/container_app.html.markdown b/website/docs/r/container_app.html.markdown index 23a7ebc2ffcc..ae967dff9b21 100644 --- a/website/docs/r/container_app.html.markdown +++ b/website/docs/r/container_app.html.markdown @@ -124,6 +124,8 @@ A `template` block supports the following: * `revision_suffix` - (Optional) The suffix for the revision. This value must be unique for the lifetime of the Resource. If omitted the service will use a hash function to create one. +* `termination_grace_period_seconds` - (Optional) The time in seconds after the container is sent the termination signal before the process if forcibly killed. + * `volume` - (Optional) A `volume` block as detailed below. --- diff --git a/website/docs/r/container_registry_credential_set.html.markdown b/website/docs/r/container_registry_credential_set.html.markdown new file mode 100644 index 000000000000..72311bf0e8c2 --- /dev/null +++ b/website/docs/r/container_registry_credential_set.html.markdown @@ -0,0 +1,170 @@ +--- +subcategory: "Container" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_container_registry_credential_set" +description: |- + Manages a Container Registry Credential Set. +--- + +# azurerm_container_registry_credential_set + +Manages a Container Registry Credential Set. + +## Example Usage (minimal) + +~> NOTE: Be aware that you will need to permit the Identity that is created for the Container Registry to have `get` on secrets to the Key Vault, e.g. using the `azurerm_key_vault_access_policy` resource. + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_container_registry" "example" { + name = "exampleContainerRegistry" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + sku = "Basic" +} + +resource "azurerm_container_registry_credential_set" "example" { + name = "exampleCredentialSet" + container_registry_id = "azurerm_container_registry.example.id" + login_server = "docker.io" + identity { + type = "SystemAssigned" + } + authentication_credentials { + username_secret_id = "https://example-keyvault.vault.azure.net/secrets/example-user-name" + password_secret_id = "https://example-keyvault.vault.azure.net/secrets/example-user-password" + } +} +``` + +## Example Usage (full) + +This example provisions a key vault with two secrets, a container registry, a container registry credential set, and an access policy to allow the container registry to read the secrets from the key vault. + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_key_vault" "example" { + name = "examplekeyvault" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + tenant_id = data.azurerm_client_config.current.tenant_id + sku_name = "standard" + soft_delete_retention_days = 7 + access_policy { + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = data.azurerm_client_config.current.object_id + certificate_permissions = [] + key_permissions = [] + secret_permissions = ["Get", "Set", "Delete", "Purge"] + } +} + +resource "azurerm_key_vault_secret" "example_user" { + key_vault_id = azurerm_key_vault.example.id + name = "example-user-name" + value = "name" +} + +resource "azurerm_key_vault_secret" "example_password" { + key_vault_id = azurerm_key_vault.example.id + name = "example-user-password" + value = "password" +} + +resource "azurerm_container_registry" "example" { + name = "exampleContainerRegistry" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + sku = "Basic" +} + +resource "azurerm_container_registry_credential_set" "example" { + name = "exampleCredentialSet" + container_registry_id = "azurerm_container_registry.example.id" + login_server = "docker.io" + identity { + type = "SystemAssigned" + } + authentication_credentials { + username_secret_id = azurerm_key_vault_secret.example_user.versionless_id + password_secret_id = azurerm_key_vault_secret.example_password.versionless_id + } +} + +resource "azurerm_key_vault_access_policy" "read_secrets" { + key_vault_id = azurerm_key_vault.example.id + tenant_id = azurerm_container_registry_credential_set.example.identity[0].tenant_id + object_id = azurerm_container_registry_credential_set.example.identity[0].principal_id + secret_permissions = ["Get"] +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Container Registry Credential Set. Changing this forces a new Container Registry Credential Set to be created. + +* `container_registry_id` - (Required) The ID of the Container Registry. Changing this forces a new Container Registry Credential Set to be created. + +* `login_server` - (Required) The login server for the Credential Set. Changing this forces a new Container Registry Credential Set to be created. + +* `authentication_credentials` - (Required) A `authentication_credentials` block as defined below. + +* `identity` - (Required) An `identity` block as defined below. + +--- + +A `authentication_credentials` block supports the following: + +* `username_secret_id` - (Required) The URI of the secret containing the username in a Key Vault. + +* `password_secret_id` - (Required) The URI of the secret containing the password in a Key Vault. + +~> NOTE: Be aware that you will need to permit the Identity that is created for the Container Registry to have `get` on secrets to the Key Vault, e.g. using the `azurerm_key_vault_access_policy` resource. + +An `identity` block supports the following: + +* `type` - (Required) The type of Managed Service Identity that is configured on for the Container Registry Credential Set. Currently the only possible value is `SystemAssigned`. + + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Container Registry Credential Set. + +--- + +A `identity` block exports the following: + +* `principal_id` - The principal ID of the Identity. + +* `tenant_id` - The tenant ID of the Identity. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Container Registry Credential Set. +* `read` - (Defaults to 5 minutes) Used when retrieving the Container Registry Credential Set. +* `update` - (Defaults to 30 minutes) Used when updating the Container Registry Credential Set. +* `delete` - (Defaults to 30 minutes) Used when deleting the Container Registry Credential Set. + +## Import + +Container Registry Credential Sets can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_container_registry_credential_set.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ContainerRegistry/registries/registry1/credentialSets/credentialSet1 +``` diff --git a/website/docs/r/data_protection_backup_vault.html.markdown b/website/docs/r/data_protection_backup_vault.html.markdown index df58c302a2b3..2ed4d8c65404 100644 --- a/website/docs/r/data_protection_backup_vault.html.markdown +++ b/website/docs/r/data_protection_backup_vault.html.markdown @@ -55,7 +55,9 @@ The following arguments are supported: -> **Note:** The `retention_duration_in_days` is the number of days for which deleted data is retained before being permanently deleted. Retention period till 14 days are free of cost, however, retention beyond 14 days may incur additional charges. The `retention_duration_in_days` is required when the `soft_delete` is set to `On`. -* `soft_delete` - (Optional) The state of soft delete for this Backup Vault. Possible values are `AlwaysOn`, `Off` and `On`. Defaults to `On`. +* `immutability` - (Optional) The state of immutability for this Backup Vault. Possible values are `Disabled`, `Locked`, and `Unlocked`. Defaults to `Disabled`. Changing this from `Locked` to anything else forces a new Backup Vault to be created. + +* `soft_delete` - (Optional) The state of soft delete for this Backup Vault. Possible values are `AlwaysOn`, `Off`, and `On`. Defaults to `On`. -> **Note:** Once the `soft_delete` is set to `AlwaysOn`, the setting cannot be changed. diff --git a/website/docs/r/kubernetes_cluster_node_pool.html.markdown b/website/docs/r/kubernetes_cluster_node_pool.html.markdown index 32533569cf5c..41f3ee87c379 100644 --- a/website/docs/r/kubernetes_cluster_node_pool.html.markdown +++ b/website/docs/r/kubernetes_cluster_node_pool.html.markdown @@ -14,6 +14,8 @@ Manages a Node Pool within a Kubernetes Cluster ~> **NOTE:** Multiple Node Pools are only supported when the Kubernetes Cluster is using Virtual Machine Scale Sets. +-> **Note:** Changing certain properties is done by cycling the node pool. When cycling it, it doesn’t perform cordon and drain, and it will disrupt rescheduling pods currently running on the previous node pool. `temporary_name_for_rotation` must be specified when changing any of the following properties: `fips_enabled`, `host_encryption_enabled`, `kubelet_config`, `linux_os_config`, `max_pods`, `node_public_ip_enabled`, `os_disk_size_gb`, `os_disk_type`, `pod_subnet_id`, `snapshot_id`, `ultra_ssd_enabled`, `vm_size`, `vnet_subnet_id`, `zones`. + ## Example Usage This example provisions a basic Kubernetes Node Pool. Other examples of the `azurerm_kubernetes_cluster_node_pool` resource can be found in [the `./examples/kubernetes` directory within the GitHub Repository](https://github.com/hashicorp/terraform-provider-azurerm/tree/main/examples/kubernetes) @@ -66,7 +68,7 @@ The following arguments are supported: ~> **NOTE:** The type of Default Node Pool for the Kubernetes Cluster must be `VirtualMachineScaleSets` to attach multiple node pools. -* `vm_size` - (Required) The SKU which should be used for the Virtual Machines used in this Node Pool. Changing this forces a new resource to be created. +* `vm_size` - (Required) The SKU which should be used for the Virtual Machines used in this Node Pool. Changing this property requires specifying `temporary_name_for_rotation`. --- @@ -74,11 +76,11 @@ The following arguments are supported: * `auto_scaling_enabled` - (Optional) Whether to enable [auto-scaler](https://docs.microsoft.com/azure/aks/cluster-autoscaler). -* `host_encryption_enabled` - (Optional) Should the nodes in this Node Pool have host encryption enabled? Changing this forces a new resource to be created. +* `host_encryption_enabled` - (Optional) Should the nodes in this Node Pool have host encryption enabled? Changing this property requires specifying `temporary_name_for_rotation`. ~> **NOTE:** Additional fields must be configured depending on the value of this field - see below. -* `node_public_ip_enabled` - (Optional) Should each node have a Public IP Address? Changing this forces a new resource to be created. +* `node_public_ip_enabled` - (Optional) Should each node have a Public IP Address? Changing this property requires specifying `temporary_name_for_rotation`. * `eviction_policy` - (Optional) The Eviction Policy which should be used for Virtual Machines within the Virtual Machine Scale Set powering this Node Pool. Possible values are `Deallocate` and `Delete`. Changing this forces a new resource to be created. @@ -86,11 +88,11 @@ The following arguments are supported: * `host_group_id` - (Optional) The fully qualified resource ID of the Dedicated Host Group to provision virtual machines from. Changing this forces a new resource to be created. -* `kubelet_config` - (Optional) A `kubelet_config` block as defined below. Changing this forces a new resource to be created. +* `kubelet_config` - (Optional) A `kubelet_config` block as defined below. Changing this requires specifying `temporary_name_for_rotation`. -* `linux_os_config` - (Optional) A `linux_os_config` block as defined below. Changing this forces a new resource to be created. +* `linux_os_config` - (Optional) A `linux_os_config` block as defined below. Changing this requires specifying `temporary_name_for_rotation`. -* `fips_enabled` - (Optional) Should the nodes in this Node Pool have Federal Information Processing Standard enabled? Changing this forces a new resource to be created. +* `fips_enabled` - (Optional) Should the nodes in this Node Pool have Federal Information Processing Standard enabled? Changing this property requires specifying `temporary_name_for_rotation`. ~> **Note:** FIPS support is in Public Preview - more information and details on how to opt into the Preview can be found in [this article](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview). @@ -98,7 +100,7 @@ The following arguments are supported: * `kubelet_disk_type` - (Optional) The type of disk used by kubelet. Possible values are `OS` and `Temporary`. -* `max_pods` - (Optional) The maximum number of pods that can run on each agent. Changing this forces a new resource to be created. +* `max_pods` - (Optional) The maximum number of pods that can run on each agent. Changing this property requires specifying `temporary_name_for_rotation`. * `mode` - (Optional) Should this Node Pool be used for System or User resources? Possible values are `System` and `User`. Defaults to `User`. @@ -114,11 +116,11 @@ The following arguments are supported: -> **Note:** This version must be supported by the Kubernetes Cluster - as such the version of Kubernetes used on the Cluster/Control Plane may need to be upgraded first. -* `os_disk_size_gb` - (Optional) The Agent Operating System disk size in GB. Changing this forces a new resource to be created. +* `os_disk_size_gb` - (Optional) The Agent Operating System disk size in GB. Changing this property requires specifying `temporary_name_for_rotation`. -* `os_disk_type` - (Optional) The type of disk which should be used for the Operating System. Possible values are `Ephemeral` and `Managed`. Defaults to `Managed`. Changing this forces a new resource to be created. +* `os_disk_type` - (Optional) The type of disk which should be used for the Operating System. Possible values are `Ephemeral` and `Managed`. Defaults to `Managed`. Changing this property requires specifying `temporary_name_for_rotation`. -* `pod_subnet_id` - (Optional) The ID of the Subnet where the pods in the Node Pool should exist. Changing this forces a new resource to be created. +* `pod_subnet_id` - (Optional) The ID of the Subnet where the pods in the Node Pool should exist. Changing this property requires specifying `temporary_name_for_rotation`. * `os_sku` - (Optional) Specifies the OS SKU used by the agent pool. Possible values are `AzureLinux`, `Ubuntu`, `Windows2019` and `Windows2022`. If not specified, the default is `Ubuntu` if OSType=Linux or `Windows2019` if OSType=Windows. And the default Windows OSSKU will be changed to `Windows2022` after Windows2019 is deprecated. Changing this from `AzureLinux` or `Ubuntu` to `AzureLinux` or `Ubuntu` will not replace the resource, otherwise it forces a new resource to be created. @@ -134,7 +136,7 @@ The following arguments are supported: ~> **Note:** This field can only be configured when `priority` is set to `Spot`. -* `snapshot_id` - (Optional) The ID of the Snapshot which should be used to create this Node Pool. Changing this forces a new resource to be created. +* `snapshot_id` - (Optional) The ID of the Snapshot which should be used to create this Node Pool. Changing this property requires specifying `temporary_name_for_rotation`. * `tags` - (Optional) A mapping of tags to assign to the resource. @@ -142,11 +144,13 @@ The following arguments are supported: * `scale_down_mode` - (Optional) Specifies how the node pool should deal with scaled-down nodes. Allowed values are `Delete` and `Deallocate`. Defaults to `Delete`. -* `ultra_ssd_enabled` - (Optional) Used to specify whether the UltraSSD is enabled in the Node Pool. Defaults to `false`. See [the documentation](https://docs.microsoft.com/azure/aks/use-ultra-disks) for more information. Changing this forces a new resource to be created. +* `temporary_name_for_rotation` - (Optional) Specifies the name of the temporary node pool used to cycle the node pool when one of the relevant properties are updated. + +* `ultra_ssd_enabled` - (Optional) Used to specify whether the UltraSSD is enabled in the Node Pool. Defaults to `false`. See [the documentation](https://docs.microsoft.com/azure/aks/use-ultra-disks) for more information. Changing this property requires specifying `temporary_name_for_rotation`. * `upgrade_settings` - (Optional) A `upgrade_settings` block as documented below. -* `vnet_subnet_id` - (Optional) The ID of the Subnet where this Node Pool should exist. Changing this forces a new resource to be created. +* `vnet_subnet_id` - (Optional) The ID of the Subnet where this Node Pool should exist. Changing this property requires specifying `temporary_name_for_rotation`. ~> **NOTE:** A route table must be configured on this Subnet. @@ -156,7 +160,7 @@ The following arguments are supported: ~> **Note:** WebAssembly System Interface node pools are in Public Preview - more information and details on how to opt into the preview can be found in [this article](https://docs.microsoft.com/azure/aks/use-wasi-node-pools) -* `zones` - (Optional) Specifies a list of Availability Zones in which this Kubernetes Cluster Node Pool should be located. Changing this forces a new Kubernetes Cluster Node Pool to be created. +* `zones` - (Optional) Specifies a list of Availability Zones in which this Kubernetes Cluster Node Pool should be located. Changing this property requires specifying `temporary_name_for_rotation`. --- @@ -178,37 +182,37 @@ If `auto_scaling_enabled` is set to `false`, then the following fields can also A `kubelet_config` block supports the following: -* `allowed_unsafe_sysctls` - (Optional) Specifies the allow list of unsafe sysctls command or patterns (ending in `*`). Changing this forces a new resource to be created. +* `allowed_unsafe_sysctls` - (Optional) Specifies the allow list of unsafe sysctls command or patterns (ending in `*`). -* `container_log_max_line` - (Optional) Specifies the maximum number of container log files that can be present for a container. must be at least 2. Changing this forces a new resource to be created. +* `container_log_max_line` - (Optional) Specifies the maximum number of container log files that can be present for a container. must be at least 2. -* `container_log_max_size_mb` - (Optional) Specifies the maximum size (e.g. 10MB) of container log file before it is rotated. Changing this forces a new resource to be created. +* `container_log_max_size_mb` - (Optional) Specifies the maximum size (e.g. 10MB) of container log file before it is rotated. -* `cpu_cfs_quota_enabled` - (Optional) Is CPU CFS quota enforcement for containers enabled? Changing this forces a new resource to be created. +* `cpu_cfs_quota_enabled` - (Optional) Is CPU CFS quota enforcement for containers enabled? Defaults to `true`. -* `cpu_cfs_quota_period` - (Optional) Specifies the CPU CFS quota period value. Changing this forces a new resource to be created. +* `cpu_cfs_quota_period` - (Optional) Specifies the CPU CFS quota period value. -* `cpu_manager_policy` - (Optional) Specifies the CPU Manager policy to use. Possible values are `none` and `static`, Changing this forces a new resource to be created. +* `cpu_manager_policy` - (Optional) Specifies the CPU Manager policy to use. Possible values are `none` and `static`, -* `image_gc_high_threshold` - (Optional) Specifies the percent of disk usage above which image garbage collection is always run. Must be between `0` and `100`. Changing this forces a new resource to be created. +* `image_gc_high_threshold` - (Optional) Specifies the percent of disk usage above which image garbage collection is always run. Must be between `0` and `100`. -* `image_gc_low_threshold` - (Optional) Specifies the percent of disk usage lower than which image garbage collection is never run. Must be between `0` and `100`. Changing this forces a new resource to be created. +* `image_gc_low_threshold` - (Optional) Specifies the percent of disk usage lower than which image garbage collection is never run. Must be between `0` and `100`. -* `pod_max_pid` - (Optional) Specifies the maximum number of processes per pod. Changing this forces a new resource to be created. +* `pod_max_pid` - (Optional) Specifies the maximum number of processes per pod. -* `topology_manager_policy` - (Optional) Specifies the Topology Manager policy to use. Possible values are `none`, `best-effort`, `restricted` or `single-numa-node`. Changing this forces a new resource to be created. +* `topology_manager_policy` - (Optional) Specifies the Topology Manager policy to use. Possible values are `none`, `best-effort`, `restricted` or `single-numa-node`. --- A `linux_os_config` block supports the following: -* `swap_file_size_mb` - (Optional) Specifies the size of swap file on each node in MB. Changing this forces a new resource to be created. +* `swap_file_size_mb` - (Optional) Specifies the size of swap file on each node in MB. -* `sysctl_config` - (Optional) A `sysctl_config` block as defined below. Changing this forces a new resource to be created. +* `sysctl_config` - (Optional) A `sysctl_config` block as defined below. -* `transparent_huge_page_defrag` - (Optional) specifies the defrag configuration for Transparent Huge Page. Possible values are `always`, `defer`, `defer+madvise`, `madvise` and `never`. Changing this forces a new resource to be created. +* `transparent_huge_page_defrag` - (Optional) specifies the defrag configuration for Transparent Huge Page. Possible values are `always`, `defer`, `defer+madvise`, `madvise` and `never`. -* `transparent_huge_page_enabled` - (Optional) Specifies the Transparent Huge Page enabled configuration. Possible values are `always`, `madvise` and `never`. Changing this forces a new resource to be created. +* `transparent_huge_page_enabled` - (Optional) Specifies the Transparent Huge Page enabled configuration. Possible values are `always`, `madvise` and `never`. --- @@ -236,63 +240,63 @@ A `sysctl_config` block supports the following: ~> For more information, please refer to [Linux Kernel Doc](https://www.kernel.org/doc/html/latest/admin-guide/sysctl/index.html). -* `fs_aio_max_nr` - (Optional) The sysctl setting fs.aio-max-nr. Must be between `65536` and `6553500`. Changing this forces a new resource to be created. +* `fs_aio_max_nr` - (Optional) The sysctl setting fs.aio-max-nr. Must be between `65536` and `6553500`. -* `fs_file_max` - (Optional) The sysctl setting fs.file-max. Must be between `8192` and `12000500`. Changing this forces a new resource to be created. +* `fs_file_max` - (Optional) The sysctl setting fs.file-max. Must be between `8192` and `12000500`. -* `fs_inotify_max_user_watches` - (Optional) The sysctl setting fs.inotify.max_user_watches. Must be between `781250` and `2097152`. Changing this forces a new resource to be created. +* `fs_inotify_max_user_watches` - (Optional) The sysctl setting fs.inotify.max_user_watches. Must be between `781250` and `2097152`. -* `fs_nr_open` - (Optional) The sysctl setting fs.nr_open. Must be between `8192` and `20000500`. Changing this forces a new resource to be created. +* `fs_nr_open` - (Optional) The sysctl setting fs.nr_open. Must be between `8192` and `20000500`. -* `kernel_threads_max` - (Optional) The sysctl setting kernel.threads-max. Must be between `20` and `513785`. Changing this forces a new resource to be created. +* `kernel_threads_max` - (Optional) The sysctl setting kernel.threads-max. Must be between `20` and `513785`. -* `net_core_netdev_max_backlog` - (Optional) The sysctl setting net.core.netdev_max_backlog. Must be between `1000` and `3240000`. Changing this forces a new resource to be created. +* `net_core_netdev_max_backlog` - (Optional) The sysctl setting net.core.netdev_max_backlog. Must be between `1000` and `3240000`. -* `net_core_optmem_max` - (Optional) The sysctl setting net.core.optmem_max. Must be between `20480` and `4194304`. Changing this forces a new resource to be created. +* `net_core_optmem_max` - (Optional) The sysctl setting net.core.optmem_max. Must be between `20480` and `4194304`. -* `net_core_rmem_default` - (Optional) The sysctl setting net.core.rmem_default. Must be between `212992` and `134217728`. Changing this forces a new resource to be created. +* `net_core_rmem_default` - (Optional) The sysctl setting net.core.rmem_default. Must be between `212992` and `134217728`. -* `net_core_rmem_max` - (Optional) The sysctl setting net.core.rmem_max. Must be between `212992` and `134217728`. Changing this forces a new resource to be created. +* `net_core_rmem_max` - (Optional) The sysctl setting net.core.rmem_max. Must be between `212992` and `134217728`. -* `net_core_somaxconn` - (Optional) The sysctl setting net.core.somaxconn. Must be between `4096` and `3240000`. Changing this forces a new resource to be created. +* `net_core_somaxconn` - (Optional) The sysctl setting net.core.somaxconn. Must be between `4096` and `3240000`. -* `net_core_wmem_default` - (Optional) The sysctl setting net.core.wmem_default. Must be between `212992` and `134217728`. Changing this forces a new resource to be created. +* `net_core_wmem_default` - (Optional) The sysctl setting net.core.wmem_default. Must be between `212992` and `134217728`. -* `net_core_wmem_max` - (Optional) The sysctl setting net.core.wmem_max. Must be between `212992` and `134217728`. Changing this forces a new resource to be created. +* `net_core_wmem_max` - (Optional) The sysctl setting net.core.wmem_max. Must be between `212992` and `134217728`. -* `net_ipv4_ip_local_port_range_max` - (Optional) The sysctl setting net.ipv4.ip_local_port_range max value. Must be between `32768` and `65535`. Changing this forces a new resource to be created. +* `net_ipv4_ip_local_port_range_max` - (Optional) The sysctl setting net.ipv4.ip_local_port_range max value. Must be between `32768` and `65535`. -* `net_ipv4_ip_local_port_range_min` - (Optional) The sysctl setting net.ipv4.ip_local_port_range min value. Must be between `1024` and `60999`. Changing this forces a new resource to be created. +* `net_ipv4_ip_local_port_range_min` - (Optional) The sysctl setting net.ipv4.ip_local_port_range min value. Must be between `1024` and `60999`. -* `net_ipv4_neigh_default_gc_thresh1` - (Optional) The sysctl setting net.ipv4.neigh.default.gc_thresh1. Must be between `128` and `80000`. Changing this forces a new resource to be created. +* `net_ipv4_neigh_default_gc_thresh1` - (Optional) The sysctl setting net.ipv4.neigh.default.gc_thresh1. Must be between `128` and `80000`. -* `net_ipv4_neigh_default_gc_thresh2` - (Optional) The sysctl setting net.ipv4.neigh.default.gc_thresh2. Must be between `512` and `90000`. Changing this forces a new resource to be created. +* `net_ipv4_neigh_default_gc_thresh2` - (Optional) The sysctl setting net.ipv4.neigh.default.gc_thresh2. Must be between `512` and `90000`. -* `net_ipv4_neigh_default_gc_thresh3` - (Optional) The sysctl setting net.ipv4.neigh.default.gc_thresh3. Must be between `1024` and `100000`. Changing this forces a new resource to be created. +* `net_ipv4_neigh_default_gc_thresh3` - (Optional) The sysctl setting net.ipv4.neigh.default.gc_thresh3. Must be between `1024` and `100000`. -* `net_ipv4_tcp_fin_timeout` - (Optional) The sysctl setting net.ipv4.tcp_fin_timeout. Must be between `5` and `120`. Changing this forces a new resource to be created. +* `net_ipv4_tcp_fin_timeout` - (Optional) The sysctl setting net.ipv4.tcp_fin_timeout. Must be between `5` and `120`. -* `net_ipv4_tcp_keepalive_intvl` - (Optional) The sysctl setting net.ipv4.tcp_keepalive_intvl. Must be between `10` and `90`. Changing this forces a new resource to be created. +* `net_ipv4_tcp_keepalive_intvl` - (Optional) The sysctl setting net.ipv4.tcp_keepalive_intvl. Must be between `10` and `90`. -* `net_ipv4_tcp_keepalive_probes` - (Optional) The sysctl setting net.ipv4.tcp_keepalive_probes. Must be between `1` and `15`. Changing this forces a new resource to be created. +* `net_ipv4_tcp_keepalive_probes` - (Optional) The sysctl setting net.ipv4.tcp_keepalive_probes. Must be between `1` and `15`. -* `net_ipv4_tcp_keepalive_time` - (Optional) The sysctl setting net.ipv4.tcp_keepalive_time. Must be between `30` and `432000`. Changing this forces a new resource to be created. +* `net_ipv4_tcp_keepalive_time` - (Optional) The sysctl setting net.ipv4.tcp_keepalive_time. Must be between `30` and `432000`. -* `net_ipv4_tcp_max_syn_backlog` - (Optional) The sysctl setting net.ipv4.tcp_max_syn_backlog. Must be between `128` and `3240000`. Changing this forces a new resource to be created. +* `net_ipv4_tcp_max_syn_backlog` - (Optional) The sysctl setting net.ipv4.tcp_max_syn_backlog. Must be between `128` and `3240000`. -* `net_ipv4_tcp_max_tw_buckets` - (Optional) The sysctl setting net.ipv4.tcp_max_tw_buckets. Must be between `8000` and `1440000`. Changing this forces a new resource to be created. +* `net_ipv4_tcp_max_tw_buckets` - (Optional) The sysctl setting net.ipv4.tcp_max_tw_buckets. Must be between `8000` and `1440000`. -* `net_ipv4_tcp_tw_reuse` - (Optional) Is sysctl setting net.ipv4.tcp_tw_reuse enabled? Changing this forces a new resource to be created. +* `net_ipv4_tcp_tw_reuse` - (Optional) Is sysctl setting net.ipv4.tcp_tw_reuse enabled? -* `net_netfilter_nf_conntrack_buckets` - (Optional) The sysctl setting net.netfilter.nf_conntrack_buckets. Must be between `65536` and `524288`. Changing this forces a new resource to be created. +* `net_netfilter_nf_conntrack_buckets` - (Optional) The sysctl setting net.netfilter.nf_conntrack_buckets. Must be between `65536` and `524288`. -* `net_netfilter_nf_conntrack_max` - (Optional) The sysctl setting net.netfilter.nf_conntrack_max. Must be between `131072` and `2097152`. Changing this forces a new resource to be created. +* `net_netfilter_nf_conntrack_max` - (Optional) The sysctl setting net.netfilter.nf_conntrack_max. Must be between `131072` and `2097152`. -* `vm_max_map_count` - (Optional) The sysctl setting vm.max_map_count. Must be between `65530` and `262144`. Changing this forces a new resource to be created. +* `vm_max_map_count` - (Optional) The sysctl setting vm.max_map_count. Must be between `65530` and `262144`. -* `vm_swappiness` - (Optional) The sysctl setting vm.swappiness. Must be between `0` and `100`. Changing this forces a new resource to be created. +* `vm_swappiness` - (Optional) The sysctl setting vm.swappiness. Must be between `0` and `100`. -* `vm_vfs_cache_pressure` - (Optional) The sysctl setting vm.vfs_cache_pressure. Must be between `0` and `100`. Changing this forces a new resource to be created. +* `vm_vfs_cache_pressure` - (Optional) The sysctl setting vm.vfs_cache_pressure. Must be between `0` and `100`. --- @@ -300,7 +304,7 @@ A `upgrade_settings` block supports the following: * `drain_timeout_in_minutes` - (Optional) The amount of time in minutes to wait on eviction of pods and graceful termination per node. This eviction wait time honors waiting on pod disruption budgets. If this time is exceeded, the upgrade fails. Unsetting this after configuring it will force a new resource to be created. -* `node_soak_duration_in_minutes` - (Optional) The amount of time in minutes to wait after draining a node and before reimaging and moving on to next node. Defaults to `0`. +* `node_soak_duration_in_minutes` - (Optional) The amount of time in minutes to wait after draining a node and before reimaging and moving on to next node. * `max_surge` - (Required) The maximum number or percentage of nodes which will be added to the Node Pool size during an upgrade. diff --git a/website/docs/r/linux_function_app.html.markdown b/website/docs/r/linux_function_app.html.markdown index dd13e8ac0582..9c1d3b1bca94 100644 --- a/website/docs/r/linux_function_app.html.markdown +++ b/website/docs/r/linux_function_app.html.markdown @@ -183,7 +183,7 @@ A `application_stack` block supports the following: ~> **NOTE:** The value `21` is currently in Preview for `java_version`. -* `node_version` - (Optional) The version of Node to run. Possible values include `12`, `14`, `16`, `18` and `20`. +* `node_version` - (Optional) The version of Node to run. Possible values include `12`, `14`, `16`, `18` `20` and `22`. * `python_version` - (Optional) The version of Python to run. Possible values are `3.12`, `3.11`, `3.10`, `3.9`, `3.8` and `3.7`. diff --git a/website/docs/r/linux_web_app.html.markdown b/website/docs/r/linux_web_app.html.markdown index af1fdfeb1d1f..800bc341f270 100644 --- a/website/docs/r/linux_web_app.html.markdown +++ b/website/docs/r/linux_web_app.html.markdown @@ -168,7 +168,7 @@ An `application_stack` block supports the following: * `java_version` - (Optional) The Version of Java to use. Possible values include `8`, `11`, `17`, and `21`. -~> **NOTE:** The valid version combinations for `java_version`, `java_server` and `java_server_version` can be checked from the command line via `az webapp list-runtimes --linux`. +~> **NOTE:** The valid version combinations for `java_version`, `java_server` and `java_server_version` can be checked from the command line via `az webapp list-runtimes --os-type linux`. ~> **NOTE:** `java_server`, `java_server_version`, and `java_version` must all be specified if building a java app diff --git a/website/docs/r/linux_web_app_slot.html.markdown b/website/docs/r/linux_web_app_slot.html.markdown index 02fac2d4b3d0..8ebb66c6a07b 100644 --- a/website/docs/r/linux_web_app_slot.html.markdown +++ b/website/docs/r/linux_web_app_slot.html.markdown @@ -172,7 +172,7 @@ An `application_stack` block supports the following: * `java_version` - (Optional) The Version of Java to use. Possible values include `8`, `11`, and `17`. -~> **NOTE:** The valid version combinations for `java_version`, `java_server` and `java_server_version` can be checked from the command line via `az webapp list-runtimes --linux`. +~> **NOTE:** The valid version combinations for `java_version`, `java_server` and `java_server_version` can be checked from the command line via `az webapp list-runtimes --os-type linux`. * `node_version` - (Optional) The version of Node to run. Possible values are `12-lts`, `14-lts`, `16-lts`, `18-lts` and `20-lts`. This property conflicts with `java_version`. diff --git a/website/docs/r/mssql_job.html.markdown b/website/docs/r/mssql_job.html.markdown new file mode 100644 index 000000000000..35c9e5c57992 --- /dev/null +++ b/website/docs/r/mssql_job.html.markdown @@ -0,0 +1,91 @@ +--- +subcategory: "Database" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mssql_job" +description: |- + Manages an Elastic Job. +--- + +# azurerm_mssql_job + +Manages an Elastic Job. + +## Example Usage + +```hcl + +resource "azurerm_resource_group" "example" { + name = "example-resource-group" + location = "East US" +} + +resource "azurerm_mssql_server" "example" { + name = "example-server" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + version = "12.0" + administrator_login = "4dm1n157r470r" + administrator_login_password = "4-v3ry-53cr37-p455w0rd" +} + +resource "azurerm_mssql_database" "example" { + name = "example-db" + server_id = azurerm_mssql_server.example.id + collation = "SQL_Latin1_General_CP1_CI_AS" + sku_name = "S1" +} + +resource "azurerm_mssql_job_agent" "example" { + name = "example-job-agent" + location = azurerm_resource_group.example.location + database_id = azurerm_mssql_database.example.id +} + +resource "azurerm_mssql_job_credential" "example" { + name = "example-job-credential" + job_agent_id = azurerm_mssql_job_agent.example.id + username = "my-username" + password = "MyP4ssw0rd!!!" +} + +resource "azurerm_mssql_job" "example" { + name = "example-job" + job_agent_id = azurerm_mssql_job_agent.example.id + description = "example description" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Elastic Job. Changing this forces a new Elastic Job to be created. + +* `job_agent_id` - (Required) The ID of the Elastic Job Agent. Changing this forces a new Elastic Job to be created. + +--- + +* `description` - (Optional) The description of the Elastic Job. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Elastic Job. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Elastic Job. +* `read` - (Defaults to 5 minutes) Used when retrieving the Elastic Job. +* `update` - (Defaults to 30 minutes) Used when updating the Elastic Job. +* `delete` - (Defaults to 30 minutes) Used when deleting the Elastic Job. + +## Import + +Elastic Jobs can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_mssql_job.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Sql/servers/myserver1/jobAgents/myjobagent1/jobs/myjob1 +``` diff --git a/website/docs/r/mssql_job_schedule.html.markdown b/website/docs/r/mssql_job_schedule.html.markdown new file mode 100644 index 000000000000..7449e35ce493 --- /dev/null +++ b/website/docs/r/mssql_job_schedule.html.markdown @@ -0,0 +1,107 @@ +--- +subcategory: "Database" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mssql_job_schedule" +description: |- + Manages an Elastic Job Schedule. +--- + +# azurerm_mssql_job_schedule + +Manages an Elastic Job Schedule. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resource-group" + location = "East US" +} + +resource "azurerm_mssql_server" "example" { + name = "example-server" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + version = "12.0" + administrator_login = "4dm1n157r470r" + administrator_login_password = "4-v3ry-53cr37-p455w0rd" +} + +resource "azurerm_mssql_database" "example" { + name = "example-db" + server_id = azurerm_mssql_server.example.id + collation = "SQL_Latin1_General_CP1_CI_AS" + sku_name = "S1" +} + +resource "azurerm_mssql_job_agent" "example" { + name = "example-job-agent" + location = azurerm_resource_group.example.location + database_id = azurerm_mssql_database.example.id +} + +resource "azurerm_mssql_job_credential" "example" { + name = "example-job-credential" + job_agent_id = azurerm_mssql_job_agent.example.id + username = "my-username" + password = "MyP4ssw0rd!!!" +} + +resource "azurerm_mssql_job" "example" { + name = "example-job" + job_agent_id = azurerm_mssql_job_agent.example.id +} + +resource "azurerm_mssql_job_schedule" "example" { + job_id = azurerm_mssql_job.example.id + + type = "Recurring" + enabled = true + end_time = "2025-12-01T00:00:00Z" + interval = "PT5M" + start_time = "2025-01-01T00:00:00Z" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `job_id` - (Required) The ID of the Elastic Job. Changing this forces a new Elastic Job Schedule to be created. + +* `type` - (Required) The type of schedule. Possible values are `Once` and `Recurring`. + +--- + +* `enabled` - (Optional) Should the Elastic Job Schedule be enabled? Defaults to `false`. + +~> **Note**: When `type` is set to `Once` and `enabled` is set to `true`, it's recommended to add `enabled` to `ignore_changes`. This is because Azure will set `enabled` to `false` once the job has executed. + +* `end_time` - (Optional) The end time of the schedule. Must be in RFC3339 format. + +* `interval` - (Optional) The interval between job executions. Must be in ISO8601 duration format. + +* `start_time` - (Optional) The start time of the schedule. Must be in RFC3339 format. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Elastic Job Schedule. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Elastic Job Schedule. +* `read` - (Defaults to 5 minutes) Used when retrieving the Elastic Job Schedule. +* `update` - (Defaults to 30 minutes) Used when updating the Elastic Job Schedule. +* `delete` - (Defaults to 30 minutes) Used when deleting the Elastic Job Schedule. + +## Import + +Elastic Job Schedules can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_mssql_job_schedule.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Sql/servers/myserver1/jobAgents/myjobagent1/jobs/myjob1 +``` diff --git a/website/docs/r/redis_enterprise_cluster.html.markdown b/website/docs/r/redis_enterprise_cluster.html.markdown index 07b145d1d375..50ddc40f1a11 100644 --- a/website/docs/r/redis_enterprise_cluster.html.markdown +++ b/website/docs/r/redis_enterprise_cluster.html.markdown @@ -37,7 +37,7 @@ The following arguments are supported: * `location` - (Required) The Azure Region where the Redis Enterprise Cluster should exist. Changing this forces a new Redis Enterprise Cluster to be created. -* `sku_name` - (Required) The `sku_name` is comprised of two segments separated by a hyphen (e.g. `Enterprise_E10-2`). The first segment of the `sku_name` defines the `name` of the SKU, possible values are `Enterprise_E1`, `Enterprise_E5`, `Enterprise_E10`, `Enterprise_E20`, `Enterprise_E50`, `Enterprise_E100`, `Enterprise_E200`, `Enterprise_E400`, `EnterpriseFlash_F300`, `EnterpriseFlash_F700` or `EnterpriseFlash_F1500`. The second segment defines the `capacity` of the `sku_name`, possible values for `Enteprise` SKUs are (`2`, `4`, `6`, ...). Possible values for `EnterpriseFlash` SKUs are (`3`, `9`, `15`, ...). Changing this forces a new Redis Enterprise Cluster to be created. +* `sku_name` - (Required) The `sku_name` is comprised of two segments separated by a hyphen (e.g. `Enterprise_E10-2`). The first segment of the `sku_name` defines the `name` of the SKU, possible values are `Enterprise_E5`, `Enterprise_E10`, `Enterprise_E20`, `Enterprise_E50`, `Enterprise_E100`, `Enterprise_E200`, `Enterprise_E400`, `EnterpriseFlash_F300`, `EnterpriseFlash_F700` or `EnterpriseFlash_F1500`. The second segment defines the `capacity` of the `sku_name`, possible values for `Enteprise` SKUs are (`2`, `4`, `6`, ...). Possible values for `EnterpriseFlash` SKUs are (`3`, `9`, `15`, ...). Changing this forces a new Redis Enterprise Cluster to be created. * `minimum_tls_version` - (Optional) The minimum TLS version. Possible values are `1.0`, `1.1` and `1.2`. Defaults to `1.2`. Changing this forces a new Redis Enterprise Cluster to be created. diff --git a/website/docs/r/windows_function_app.html.markdown b/website/docs/r/windows_function_app.html.markdown index 33eae536b5d5..f29396cc5660 100644 --- a/website/docs/r/windows_function_app.html.markdown +++ b/website/docs/r/windows_function_app.html.markdown @@ -175,7 +175,7 @@ A `application_stack` block supports the following: * `java_version` - (Optional) The Version of Java to use. Supported versions include `1.8`, `11`, `17`, `21` (In-Preview). -* `node_version` - (Optional) The version of Node to run. Possible values include `~12`, `~14`, `~16`, `~18` and `~20`. +* `node_version` - (Optional) The version of Node to run. Possible values include `~12`, `~14`, `~16`, `~18` `~20` and `~22`. * `powershell_core_version` - (Optional) The version of PowerShell Core to run. Possible values are `7`, `7.2`, and `7.4`.