terraform-provider-logicmonitor
terraform-provider-logicmonitor copied to clipboard
Device group property changed but not recorded in state file?
I have an interesting problem where properties set on a device group via Terraform are successfully changed via the LM API (and I can see the properties in my portal), but the Terraform state file does not seem to get updated. The device group being modified already exists, not created from new.
Showing what changes would be done:
iehrenwald@iehren-w00860:~/src/theCompany/git/terraform/logicmonitor$ terraform plan -target=module.XXdc01.module.dg
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
data.vault_generic_secret.logicmonitor_api_id: Refreshing state...
data.vault_generic_secret.logicmonitor_api_key: Refreshing state...
data.logicmonitor_device_group.dg_corp_division_root: Refreshing state...
data.logicmonitor_device_group.dg_datacenters: Refreshing state...
logicmonitor_device_group.dg: Refreshing state... (ID: 150)
------------------------------------------------------------------------
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.XXdc01.module.dg.logicmonitor_device_group.dg
properties.%: "0" => "1"
properties.location: "" => "123 Maple St, Yourtown, State, 12345, USA"
Plan: 0 to add, 1 to change, 0 to destroy.
------------------------------------------------------------------------
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
iehrenwald@iehren-w00860:~/src/theCompany/git/terraform/logicmonitor$
Applying above changes:
iehrenwald@iehren-w00860:~/src/theCompany/git/terraform/logicmonitor$ terraform apply -target=module.XXdc01.module.dg
data.vault_generic_secret.logicmonitor_api_key: Refreshing state...
data.vault_generic_secret.logicmonitor_api_id: Refreshing state...
data.logicmonitor_device_group.dg_corp_division_root: Refreshing state...
data.logicmonitor_device_group.dg_datacenters: Refreshing state...
logicmonitor_device_group.dg: Refreshing state... (ID: 150)
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.XXdc01.module.dg.logicmonitor_device_group.dg
properties.%: "0" => "1"
properties.location: "" => "123 Maple St, Yourtown, State, 12345, USA"
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.XXdc01.module.dg.logicmonitor_device_group.dg: Modifying... (ID: 150)
properties.%: "0" => "1"
properties.location: "" => "123 Maple St, Yourtown, State, 12345, USA"
module.XXdc01.module.dg.logicmonitor_device_group.dg: Modifications complete after 0s (ID: 150)
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
iehrenwald@iehren-w00860:~/src/theCompany/git/terraform/logicmonitor$
Examining the resource in the remote state, noting it's missing the properties that were just applied above!
iehrenwald@iehren-w00860:~/src/theCompany/git/terraform/logicmonitor$ terraform state show module.XXdc01.module.dg.logicmonitor_device_group.dg
id = 150
applies_to =
description =
disable_alerting = false
name = XXdc01
parent_id = 305
iehrenwald@iehren-w00860:~/src/theCompany/git/terraform/logicmonitor$
Running plan
, Terraform wants to do it again:
iehrenwald@iehren-w00860:~/src/theCompany/git/terraform/logicmonitor$ terraform plan -target=module.XXdc01.module.dg
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
data.vault_generic_secret.logicmonitor_api_key: Refreshing state...
data.vault_generic_secret.logicmonitor_api_id: Refreshing state...
data.logicmonitor_device_group.dg_corp_division_root: Refreshing state...
data.logicmonitor_device_group.dg_datacenters: Refreshing state...
logicmonitor_device_group.dg: Refreshing state... (ID: 150)
------------------------------------------------------------------------
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.XXdc01.module.dg.logicmonitor_device_group.dg
properties.%: "0" => "1"
properties.location: "" => "123 Maple St, Yourtown, State, 12345, USA"
Plan: 0 to add, 1 to change, 0 to destroy.
------------------------------------------------------------------------
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
iehrenwald@iehren-w00860:~/src/theCompany/git/terraform/logicmonitor$
I did find that if I deleted the device group (and unfortunately all the devices associated with it) and re-create it, the properties for the group are set via API and visible in the state file. Is this a provider bug? A Terraform bug? I'm using Terraform 0.11.14 and v1.3.3 of the LM provider. Thanks.