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

Subnet replaced during upgrade under PRC #2323

Closed
VenelinMartinov opened this issue Aug 15, 2024 · 2 comments · Fixed by #2325 or #2306
Closed

Subnet replaced during upgrade under PRC #2323

VenelinMartinov opened this issue Aug 15, 2024 · 2 comments · Fixed by #2325 or #2306
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@VenelinMartinov
Copy link
Contributor

VenelinMartinov commented Aug 15, 2024

Describe what happened

The following example causes a replacement without any changes to the program in the Subnet resource when upgrading from anything before 5.79 to anything after 5.80 under PRC.

This is not the case under non-PRC. The cause is the addition of a new parameter default_outbound_access_enabled in TF with the following schema:

"default_outbound_access_enabled": {
	Type:     pluginsdk.TypeBool,
	Default:  true,
	Optional: true,
	ForceNew: true,
},

When the provider runs an update with the parameter not present in the state, it forces a replacement.

Unfortunately this is the truthful behaviour in TF but only under -refresh=false:

provider "azurerm" {
  features {}
  version = "3.85.0" // upgrade to 3.115.0
}

resource "azurerm_resource_group" "exampleResourceGroup" {
  name     = "exampleResourceGroup"
  location = "East US"
}

resource "azurerm_virtual_network" "exampleVirtualNetwork" {
  name                = "exampleVirtualNetwork"
  address_space       = ["10.0.0.0/16"]
  location            = azurerm_resource_group.exampleResourceGroup.location
  resource_group_name = azurerm_resource_group.exampleResourceGroup.name
}

resource "azurerm_subnet" "exampleSubnet" {
  name                 = "exampleSubnet"
  resource_group_name  = azurerm_resource_group.exampleResourceGroup.name
  virtual_network_name = azurerm_virtual_network.exampleVirtualNetwork.name
  address_prefixes     = ["10.0.2.0/24"]
}

Sample program

name: network
runtime: yaml
resources:
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: East US

  exampleVirtualNetwork:
    type: azure:network:VirtualNetwork
    properties:
      addressSpaces:
        - 10.0.0.0/16
      location: ${exampleResourceGroup.location}
      resourceGroupName: ${exampleResourceGroup.name}

  exampleSubnet:
    type: azure:network:Subnet
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      virtualNetworkName: ${exampleVirtualNetwork.name}
      addressPrefixes:
        - 10.0.2.0/24

Log output

No response

Affected Resource(s)

No response

Output of pulumi about

.

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@VenelinMartinov VenelinMartinov added the kind/bug Some behavior is incorrect or out of spec label Aug 15, 2024
@VenelinMartinov
Copy link
Contributor Author

VenelinMartinov commented Aug 15, 2024

We could solve this with a TransformFromState, similar to #2150

This could lead to inaccurate state but the parameter does have a default and if the user really cared about that state, they'd refresh it.

This would also maintain the behaviour under non-PRC.

VenelinMartinov added a commit that referenced this issue Aug 19, 2024
This prevents the `Subnet` resource from being replaced under PRC when
upgrading the provider.

Note this is an intentional divergence from the TF provider but the TF
behaviour here is bad and we are not taking up a patch for this.

Note this is already covered by `Test_network`, see failure in
https://github.com/pulumi/pulumi-azure/actions/runs/10178181276/job/28152031872?pr=2306

fixes #2323
stacked on #2306
@pulumi-bot pulumi-bot added resolution/fixed This issue was fixed labels Aug 19, 2024
@pulumi-bot
Copy link
Contributor

This issue has been addressed in PR #2306 and shipped in release v5.88.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
2 participants