Skip to content

azurerm_kusto_cluster - add a state migration to fix the <4.0 to >= 4.0 upgrade path#30438

Merged
sreallymatt merged 2 commits intomainfrom
mp/bug-8525
Aug 22, 2025
Merged

azurerm_kusto_cluster - add a state migration to fix the <4.0 to >= 4.0 upgrade path#30438
sreallymatt merged 2 commits intomainfrom
mp/bug-8525

Conversation

@sreallymatt
Copy link
Collaborator

@sreallymatt sreallymatt commented Aug 19, 2025

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

Migrates the pre-4.0 terraform state file to match the expected post-4.0 block format, preventing JSON parsing errors during refreshing. If the state is already in the correct format, this migration doesn't do anything.

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)
image

Transient failures, caught by Dalek clean up, reran:

image

State Migration Testing

Note: I had previously created a cluster, for the state migration tests I've imported it rather than recreating for each test as provisioning this takes quite a while.

Migration applied to language_extensions (List)

Details
➜  ipl-8525 tf version  
Terraform v1.12.2  
on darwin_arm64  
+ provider registry.terraform.io/hashicorp/azurerm v3.117.1  
➜  ipl-8525 tf import azurerm_kusto_cluster.cluster /subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test  
azurerm_kusto_cluster.cluster: Importing from ID "/subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test"...  
azurerm_kusto_cluster.cluster: Import prepared!  
  Prepared azurerm_kusto_cluster for import  
azurerm_kusto_cluster.cluster: Refreshing state... [id=/subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test]  
  
Import successful!  
  
The resources that were imported are shown above. These resources are now in  
your Terraform state and will henceforth be managed by Terraform.  
  
➜  ipl-8525 tfsh  
# azurerm_kusto_cluster.cluster:  
resource "azurerm_kusto_cluster" "cluster" {  
    allowed_fqdns                      = []  
    allowed_ip_ranges                  = []  
    auto_stop_enabled                  = true  
    data_ingestion_uri                 = "https://ingest-ipl8525test.eastus.kusto.windows.net"  
    disk_encryption_enabled            = false  
    double_encryption_enabled          = false  
    id                                 = "/subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test"  
    language_extensions                = [  
        "PYTHON",  
    ]  
    location                           = "eastus"  
    name                               = "ipl8525test"  
    outbound_network_access_restricted = false  
    public_ip_type                     = "IPv4"  
    public_network_access_enabled      = true  
    purge_enabled                      = false  
    resource_group_name                = "ipl8525test"  
    streaming_ingestion_enabled        = false  
    tags                               = {}  
    trusted_external_tenants           = []  
    uri                                = "https://ipl8525test.eastus.kusto.windows.net"  
    zones                              = []  
  
    sku {  
        capacity = 2  
        name     = "Standard_L8s_v3"  
    }  
}  
➜  ipl-8525 vi ~/.terraformrc  
➜  ipl-8525 tfa -refresh-only  
╷  
│ Warning: Provider development overrides are in effect  
│  
│ The following provider development overrides are set in the CLI configuration:  
│  - hashicorp/azurerm in ~/go/1.24.5/bin  
│  
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published  
│ releases.  
╵  
azurerm_resource_group.test: Refreshing state... [id=/subscriptions/{subscriptionId}/resourceGroups/ipl8525test]  
azurerm_kusto_cluster.cluster: Refreshing state... [id=/subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test]  
  
No changes. Your infrastructure still matches the configuration.  
  
Terraform has checked that the real remote objects still match the result of your most recent changes, and found no differences.  
  
Would you like to update the Terraform state to reflect these detected changes?  
  Terraform will write these changes to the state without modifying any real infrastructure.  
  There is no undo. Only 'yes' will be accepted to confirm.  
  
  Enter a value: yes  
  
  
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.  
➜  ipl-8525 tfsh  
# azurerm_kusto_cluster.cluster:  
resource "azurerm_kusto_cluster" "cluster" {  
    allowed_fqdns                      = []  
    allowed_ip_ranges                  = []  
    auto_stop_enabled                  = true  
    data_ingestion_uri                 = "https://ingest-ipl8525test.eastus.kusto.windows.net"  
    disk_encryption_enabled            = false  
    double_encryption_enabled          = false  
    id                                 = "/subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test"  
    location                           = "eastus"  
    name                               = "ipl8525test"  
    outbound_network_access_restricted = false  
    public_ip_type                     = "IPv4"  
    public_network_access_enabled      = true  
    purge_enabled                      = false  
    resource_group_name                = "ipl8525test"  
    streaming_ingestion_enabled        = false  
    tags                               = {}  
    trusted_external_tenants           = []  
    uri                                = "https://ipl8525test.eastus.kusto.windows.net"  
    zones                              = []  
  
    language_extensions {  
        image = "Python3_6_5"  
        name  = "PYTHON"  
    }  
  
    sku {  
        capacity = 2  
        name     = "Standard_L8s_v3"  
    }  
}

Migration applied to language_extensions (Block)

Details
➜  ipl-8525 tf version  
Terraform v1.12.2  
on darwin_arm64  
+ provider registry.terraform.io/hashicorp/azurerm v4.0.0  
➜  ipl-8525 tf import azurerm_kusto_cluster.cluster /subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test  
azurerm_kusto_cluster.cluster: Importing from ID "/subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test"...  
azurerm_kusto_cluster.cluster: Import prepared!  
  Prepared azurerm_kusto_cluster for import  
azurerm_kusto_cluster.cluster: Refreshing state... [id=/subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test]  
  
Import successful!  
  
The resources that were imported are shown above. These resources are now in  
your Terraform state and will henceforth be managed by Terraform.  
  
➜  ipl-8525 tfsh  
# azurerm_kusto_cluster.cluster:  
resource "azurerm_kusto_cluster" "cluster" {  
    allowed_fqdns                      = []  
    allowed_ip_ranges                  = []  
    auto_stop_enabled                  = true  
    data_ingestion_uri                 = "https://ingest-ipl8525test.eastus.kusto.windows.net"  
    disk_encryption_enabled            = false  
    double_encryption_enabled          = false  
    id                                 = "/subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test"  
    location                           = "eastus"  
    name                               = "ipl8525test"  
    outbound_network_access_restricted = false  
    public_ip_type                     = "IPv4"  
    public_network_access_enabled      = true  
    purge_enabled                      = false  
    resource_group_name                = "ipl8525test"  
    streaming_ingestion_enabled        = false  
    tags                               = {}  
    trusted_external_tenants           = []  
    uri                                = "https://ipl8525test.eastus.kusto.windows.net"  
    zones                              = []  
  
    language_extensions {  
        image = "Python3_6_5"  
        name  = "PYTHON"  
    }  
  
    sku {  
        capacity = 2  
        name     = "Standard_L8s_v3"  
    }  
}  
➜  ipl-8525 cat terraform.tfstate | grep -A 5 azurerm_kusto_cluster  
      "type": "azurerm_kusto_cluster",  
      "name": "cluster",  
      "provider": "provider[\"registry.terraform.io/hashicorp/azurerm\"]",  
      "instances": [  
        {  
          "schema_version": 1,  
➜  ipl-8525 vi ~/.terraformrc  
➜  ipl-8525 tfa -refresh-only  
╷  
│ Warning: Provider development overrides are in effect  
│  
│ The following provider development overrides are set in the CLI configuration:  
│  - hashicorp/azurerm in ~/go/1.24.5/bin  
│  
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published  
│ releases.  
╵  
azurerm_resource_group.test: Refreshing state... [id=/subscriptions/{subscriptionId}/resourceGroups/ipl8525test]  
azurerm_kusto_cluster.cluster: Refreshing state... [id=/subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test]  
  
No changes. Your infrastructure still matches the configuration.  
  
Terraform has checked that the real remote objects still match the result of your most recent changes, and found no differences.  
  
Would you like to update the Terraform state to reflect these detected changes?  
  Terraform will write these changes to the state without modifying any real infrastructure.  
  There is no undo. Only 'yes' will be accepted to confirm.  
  
  Enter a value: yes  
  
  
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.  
➜  ipl-8525 cat terraform.tfstate | grep -A 5 azurerm_kusto_cluster  
      "type": "azurerm_kusto_cluster",  
      "name": "cluster",  
      "provider": "provider[\"registry.terraform.io/hashicorp/azurerm\"]",  
      "instances": [  
        {  
          "schema_version": 2,  
➜  ipl-8525 tfsh  
# azurerm_kusto_cluster.cluster:  
resource "azurerm_kusto_cluster" "cluster" {  
    allowed_fqdns                      = []  
    allowed_ip_ranges                  = []  
    auto_stop_enabled                  = true  
    data_ingestion_uri                 = "https://ingest-ipl8525test.eastus.kusto.windows.net"  
    disk_encryption_enabled            = false  
    double_encryption_enabled          = false  
    id                                 = "/subscriptions/{subscriptionId}/resourceGroups/ipl8525test/providers/Microsoft.Kusto/clusters/ipl8525test"  
    location                           = "eastus"  
    name                               = "ipl8525test"  
    outbound_network_access_restricted = false  
    public_ip_type                     = "IPv4"  
    public_network_access_enabled      = true  
    purge_enabled                      = false  
    resource_group_name                = "ipl8525test"  
    streaming_ingestion_enabled        = false  
    tags                               = {}  
    trusted_external_tenants           = []  
    uri                                = "https://ipl8525test.eastus.kusto.windows.net"  
    zones                              = []  
  
    language_extensions {  
        image = "Python3_6_5"  
        name  = "PYTHON"  
    }  
  
    sku {  
        capacity = 2  
        name     = "Standard_L8s_v3"  
    }  
}

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

  • azurerm_resource - support for the thing1 property [GH-00000]

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #27580

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the provider.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

@sreallymatt sreallymatt marked this pull request as ready for review August 20, 2025 14:14
@sreallymatt sreallymatt requested review from a team, WodansSon and magodo as code owners August 20, 2025 14:14
@github-actions github-actions bot added the bug label Aug 20, 2025
Copy link
Member

@jackofallops jackofallops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sreallymatt - LGTM 👍

@sreallymatt sreallymatt merged commit 8199f33 into main Aug 22, 2025
53 checks passed
@sreallymatt sreallymatt deleted the mp/bug-8525 branch August 22, 2025 19:06
@github-actions github-actions bot added this to the v4.42.0 milestone Aug 22, 2025
@github-actions
Copy link
Contributor

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undocumented breaking change in 4.x with azurerm_kusto_cluster language_extensions

2 participants