Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_batch_account - Remove forceNew for public_network_access_enabled #21030

Closed
wants to merge 1 commit into from

Conversation

liuwuliuyun
Copy link
Contributor

Fixes #21014

Tried locally that changing this property does not need to force creating a new one.

Testing config:

terraform {
  required_providers {
    azapi = {
      source  = "Azure/azapi"
    }
  }
}

provider "azapi" {
}

// azurerm provider
provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "test" {
  name     = "testaccRG-batch-yun"
  location = "west europe"
}

resource "azapi_resource" "name" {
  name = "testaccyun"
  type = "Microsoft.Batch/batchAccounts@2022-01-01"
  parent_id = azurerm_resource_group.test.id
  location = azurerm_resource_group.test.location
  body = jsonencode({
    properties = {
        poolAllocationMode = "BatchService"
        publicNetworkAccess = "Disabled"
    }
  })
}

Testing evidence with AzApi:


Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
PS D:\TerraformTest\batch> terraform apply --auto-approve
azurerm_resource_group.test: Refreshing state... [id=/subscriptions/85b3dbca-5974-4067-9669-67a141095a76/resourceGroups/testaccRG-batch-yun]
azapi_resource.name: Refreshing state... [id=/subscriptions/85b3dbca-5974-4067-9669-67a141095a76/resourceGroups/testaccRG-batch-yun/providers/Microsoft.Batch/batchAccounts/testaccyun]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # azapi_resource.name will be updated in-place
  ~ resource "azapi_resource" "name" {
      ~ body                      = jsonencode(
          ~ {
              ~ properties = {
                  ~ publicNetworkAccess = "Disabled" -> "Enabled"
                    # (1 unchanged element hidden)
                }
            }
        )
        id                        = "/subscriptions/85b3dbca-5974-4067-9669-67a141095a76/resourceGroups/testaccRG-batch-yun/providers/Microsoft.Batch/batchAccounts/testaccyun"
        name                      = "testaccyun"
      ~ output                    = jsonencode({}) -> (known after apply)
        tags                      = {}
        # (7 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
azapi_resource.name: Modifying... [id=/subscriptions/85b3dbca-5974-4067-9669-67a141095a76/resourceGroups/testaccRG-batch-yun/providers/Microsoft.Batch/batchAccounts/testaccyun]
azapi_resource.name: Modifications complete after 7s [id=/subscriptions/85b3dbca-5974-4067-9669-67a141095a76/resourceGroups/testaccRG-batch-yun/providers/Microsoft.Batch/batchAccounts/testaccyun]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
PS D:\TerraformTest\batch> terraform apply --auto-approve
azurerm_resource_group.test: Refreshing state... [id=/subscriptions/85b3dbca-5974-4067-9669-67a141095a76/resourceGroups/testaccRG-batch-yun]
azapi_resource.name: Refreshing state... [id=/subscriptions/85b3dbca-5974-4067-9669-67a141095a76/resourceGroups/testaccRG-batch-yun/providers/Microsoft.Batch/batchAccounts/testaccyun]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # azapi_resource.name will be updated in-place
  ~ resource "azapi_resource" "name" {
      ~ body                      = jsonencode(
          ~ {
              ~ properties = {
                  ~ publicNetworkAccess = "Enabled" -> "Disabled"
                    # (1 unchanged element hidden)
                }
            }
        )
        id                        = "/subscriptions/85b3dbca-5974-4067-9669-67a141095a76/resourceGroups/testaccRG-batch-yun/providers/Microsoft.Batch/batchAccounts/testaccyun"
        name                      = "testaccyun"
      ~ output                    = jsonencode({}) -> (known after apply)
        tags                      = {}
        # (7 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
azapi_resource.name: Modifying... [id=/subscriptions/85b3dbca-5974-4067-9669-67a141095a76/resourceGroups/testaccRG-batch-yun/providers/Microsoft.Batch/batchAccounts/testaccyun]
azapi_resource.name: Modifications complete after 7s [id=/subscriptions/85b3dbca-5974-4067-9669-67a141095a76/resourceGroups/testaccRG-batch-yun/providers/Microsoft.Batch/batchAccounts/testaccyun]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

@liuwuliuyun liuwuliuyun changed the title Remove forceNew for public_network_access_enabled azurerm_batch_account - Remove forceNew for public_network_access_enabled Mar 20, 2023
@liuwuliuyun
Copy link
Contributor Author

close this for further investiments.

@github-actions
Copy link

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 Apr 20, 2023
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.

Changing public_network_access_enabled should not force replacement
1 participant