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

"osProfile" not being ignored when using "ignore_changes" #3592

Closed
tobydoescode opened this issue Jun 4, 2019 · 4 comments · Fixed by #5550
Closed

"osProfile" not being ignored when using "ignore_changes" #3592

tobydoescode opened this issue Jun 4, 2019 · 4 comments · Fixed by #5550

Comments

@tobydoescode
Copy link

tobydoescode commented Jun 4, 2019

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

Terraform (and AzureRM Provider) Version

$ terraform version
Terraform v0.11.13
+ provider.azurerm v1.29.0

Affected Resource(s)

  • azurerm_virtual_machine

Terraform Configuration Files

resource "azurerm_virtual_machine" "vm" {
  lifecycle {
    ignore_changes = [
      "os_profile",
      "os_profile_linux_config"
    ]
  }

  ...
}

Debug Output

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ module.<redacted>.azurerm_virtual_machine.vm
      tags.%:           "5" => "6"
      tags.BillingID:   "<redacted>" => "<redacted>"
      tags.ClientID:    "<redacted>" => "<redacted>"
      tags.Component:   "" => "<redacted>"
      tags.Environment: "" => "<redacted>"
      tags.Project:     "<redacted>" => "<redacted>"
      tags.SAPSystem:   "<redacted>" => ""
      tags.Tier:        "<redacted>" => "<redacted>"


Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.<redacted>.azurerm_virtual_machine.vm: Modifying... (ID: /subscriptions/<redacted>-...oft.Compute/virtualMachines/<redacted>)
  tags.%:           "5" => "6"
  tags.BillingID:   "<redacted>" => "<redacted>"
  tags.ClientID:    "<redacted>" => "<redacted>"
  tags.Component:   "" => "<redacted>"
  tags.Environment: "" => "<redacted>"
  tags.Project:     "<redacted>" => "<redacted>"
  tags.SAPSystem:   "<redacted>" => ""
  tags.Tier:        "<redacted>" => "<redacted>"

Error: Error applying plan:

1 error(s) occurred:

* module.<redacted>.azurerm_virtual_machine.vm: 1 error(s) occurred:

* azurerm_virtual_machine.vm: compute.VirtualMachinesClient#CreateOrUpdate: Failure sending request: StatusCode=409 -- Original Error: Code="PropertyChangeNotAllowed" Message="Changing property 'osProfile' is not allowed." Target="osProfile"

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Expected Behavior

Terraform should:

  1. display the changes it needs to make to "os_profile" in the plan
  2. not attempt to change the "os_profile" when it is included in "ignore_changes"

Actual Behavior

If there is any other change to the vm resource (e.g. tags) Terraform attempts to change this field AND change "os_profile" - which it cannot do so the apply fails.

Steps to Reproduce

  1. terraform apply
@tobydoescode
Copy link
Author

Removing the "os_profile" and "os_profile_linux_config" properties from my terraform file results in the same error.

@tombuildsstuff
Copy link
Contributor

hi @evoio

We're currently working on version 2.0 of the Azure Provider which we previously announced in #2807.

As a part of this we're introducing five new resources which will supersede the existing azurerm_virtual_machine and azurerm_virtual_machine_scale_set resources:

  • azurerm_linux_virtual_machine
  • azurerm_linux_virtual_machine_scale_set
  • azurerm_virtual_machine_scale_set_extension
  • azurerm_windows_virtual_machine
  • azurerm_windows_virtual_machine_scale_set

We recently opened #5550 which adds support for the new Virtual Machine resources - and I'm able to confirm that this is fixed in the new Virtual Machine resources - however unfortunately we have no plans to backport this to the existing azurerm_virtual_machine resource.

In order to get feedback on these new resources we'll be launching support for these new resources as an opt-in Beta in an upcoming 1.x release of the Azure Provider and ultimately release these as "GA" in the upcoming 2.0 release. We'll post an update in #2807 when both the opt-in Beta (1.x) & GA (2.0) are available - as such I'd recommend subscribing to that issue for updates.

This issue's been assigned to the milestone "2.0" since this is where this will ship - however (due to the way that closing Github Issues from PR's works, to be able to track this back for future users) this issue will be closed once the first of the new resources have been merged.

Thanks!

@ghost
Copy link

ghost commented Feb 24, 2020

This has been released in version 2.0.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.0.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 5, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants