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_virtual_machine_run_command protected_parameter change results in standard parameters being removed from state #25177

Closed
1 task done
tnavarra opened this issue Mar 7, 2024 · 2 comments · Fixed by #25186

Comments

@tnavarra
Copy link

tnavarra commented Mar 7, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.7.4

AzureRM Provider Version

3.94

Affected Resource(s)/Data Source(s)

azurerm_virtual_machine_run_command

Terraform Configuration Files

resource "azurerm_virtual_machine_run_command" "example" {

  location           = var.location
  name               = "vmrc-example"
  virtual_machine_id = azurerm_windows_virtual_machine.main.id

  source {
    script = file("${path.module}/scripts/Add-ScriptExample.ps1")
  }

  parameter {
    name  = "StandardParamOne"
    value = "SampleOne"
  }

  parameter {
    name  = "StandardParamTwo"
    value = "SampleTwo"
  }

  parameter {
    name  = "StandardParamThree"
    value = "SampleThree"
  }

  protected_parameter {
    name  = "ProtectedParamOne"
    value = "ProtectedOne"
  }

  tags = var.tags
}

Debug Output/Panic Output

N/A

Expected Behaviour

When the value of a protected parameter is changed, an apply should update the protected parameter value and not change the value of the other parameters.

Actual Behaviour

An apply shows only the protected parameter being changed. However, the other parameters are wiped from state. A subsequent plan shows a change adding the parameters back in.

Steps to Reproduce

  1. Deploy an azurerm_virtual_machine_run_command with protected and unprotected parameters.
  2. Update a protected parameter value and apply the change.
  3. Run a subsequent plan and notice that the unprotected parameters are being added again due to being previously being removed from state following the unrelated protected parameter update.

Important Factoids

No response

References

No response

@rcskosir
Copy link
Contributor

rcskosir commented Mar 8, 2024

Thank you for taking the time to open this issue. Please subscribe to PR #25186 created by @teowa for this issue.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, 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 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants