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

Azure, adding tags to existing VM #456

Closed
jsw1993 opened this issue Oct 25, 2017 · 3 comments
Closed

Azure, adding tags to existing VM #456

jsw1993 opened this issue Oct 25, 2017 · 3 comments

Comments

@jsw1993
Copy link

jsw1993 commented Oct 25, 2017

Hi.

Am trying to add some tags to an existing VM resource but get the below error. I've tried ignoring changes on OS Profile, OS Profile_Windows_Config and additional_unattend_config without sucess.

Any help would be appreciated.

Terraform Version

Tested on Terraform v0.10.2 and v0.10.7

Affected Resource(s)

azurerm_virtual_machine

Terraform Files

resource "azurerm_virtual_machine" "session1" {
name = "${var.prefix}SESSION01"
location = "${var.location}"
resource_group_name = "${azurerm_resource_group.main.name}"
network_interface_ids = ["${azurerm_network_interface.session1-1.id}"]
vm_size = "${var.sh1size}"

storage_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2016-Datacenter"
version = "latest"
}

storage_os_disk {
name = "${var.prefix}SESSION01-OS"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}

os_profile {
computer_name = "${var.prefix}SESSION01"
admin_username = "${var.ladminusername}"
admin_password = "${var.ladminpassword}"
custom_data = "${base64encode("Param ${file("ConfigureWinRM.PS1")}")}"
}
os_profile_windows_config {
provision_vm_agent = "true"
enable_automatic_upgrades = "false"

additional_unattend_config {
pass = "oobeSystem"
component = "Microsoft-Windows-Shell-Setup"
setting_name = "AutoLogon"
content = "${var.ladminpassword}true1${var.ladminusername}"
}
additional_unattend_config {
pass = "oobeSystem"
component = "Microsoft-Windows-Shell-Setup"
setting_name = "FirstLogonCommands"
content = "${file("FirstLogonCommands.xml")}"
}
}
tags {

AutoshutdownSchedule = "12:00->13:00"

}

}

Expected Behavior

Tag should be added to VM

Actual Behavior

Error applying plan:

1 error(s) occurred:

  • azurerm_virtual_machine.session1: 1 error(s) occurred:

  • azurerm_virtual_machine.session1: compute.VirtualMachinesClient#CreateOrUpdate: Failure responding to request: StatusCode=409 -- Original Error: autorest/azure: Service returned an error. Status=409 Code="PropertyChangeNotAllowed" Message="Changing property 'windowsConfiguration.additionalUnattendContent.content' is not allowed."

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.

Steps to Reproduce

terraform apply

@dominik-lekse
Copy link
Contributor

Hi jsw1993, please check if you use the latest version of the terraform azurerm provider. The error you experience is likely what has been fixed in #377. The fix is included in version >= 0.3.0.

@jsw1993
Copy link
Author

jsw1993 commented Oct 26, 2017

Fixed, sorry me being an idiot.

@jsw1993 jsw1993 closed this as completed Oct 26, 2017
@ghost
Copy link

ghost commented Apr 1, 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 Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants