terraform-provider-oci: Terraform refresh is not getting remote state ?

Description of the bug:

I’m creating full VCP stack and some test instances. If I remove VM instance via API/UI terraform doesn’t catch this (other items like IPSec works).

terraform apply

baremetal_core_instance.TFInstance3: Refreshing state... (ID: ocid1.instance.oc1.phx.abyhqljsgqgxzl6o...3tu326kvuatk5bwbzsmhoeiodlazkmph2fc4gq)
No changes. Infrastructure is up-to-date.

this OCID is terminated instance.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

My test procedure (let me know if it’s not ok). Terminated instance state seems to be correctly detected, but I was forced to also need to add ‘dhcp_options_id’ to all my subnets definition (now mandatory parameter) which quite complicate my testing (need full reprovision of some instances and subnets).

Compilation

# golang 1.8.3
mkdir /workspace/gopath
export GOPATH="/workspace/gopath"

git clone https://github.com/hashicorp/terraform $GOPATH/src/github.com/hashicorp/terraform

git clone https://github.com/oracle/terraform-provider-baremetal $GOPATH/src/github.com/oracle/terraform-provider-baremetal

cd $GOPATH/src/github.com/oracle/terraform-provider-baremetal
git fetch origin pull/159/head:acc-test-instance
git checkout acc-test-instance

make
cp terraform-provider-baremetal /usr/local/bin/terraform-provider-baremetal

Terraform test, kill one instance via OBMC UI

export TF_LOG=DEBUG

terraform refresh

# terminated server was not save in tfstate in Consul
terraform plan
...
+ module.hosts.baremetal_core_instance.hosts.2
...

# so far so good

Let you know when I made full reprovision 😉