terraform-provider-scaleway icon indicating copy to clipboard operation
terraform-provider-scaleway copied to clipboard

Resource Instance: Import failed on image attribute

Open Monitob opened this issue 3 years ago • 2 comments
trafficstars

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 other comments that do not add relevant new information or questions, 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 Version

Affected Resource(s)

  • scaleway_instance_server

Terraform Configuration Files

resource "scaleway_instance_server" "main" {
	image = "ubuntu_focal"
	type  = "DEV1-S"
}

Debug Output

 resource_instance:  ImportStateVerify attributes not equivalent. The difference is shown below. The top is actual, and the bottom is expected.
        
        (map[string]string) (len=1) {
         (string) (len=5) "image": (string) (len=45) "fr-par-1/64dc7755-9499-43af-8b68-b01e10325ee7"
        }
        
        
        (map[string]string) (len=1) {
         (string) (len=5) "image": (string) (len=12) "ubuntu_focal"
        }

Panic Output

Expected Behavior

Actual Behavior

Steps to Reproduce

When adding ImportStateVerify: true to verify the state the image will be replaced by the id of the image

Important Factoids

References

  • #0000

Monitob avatar Sep 26 '22 15:09 Monitob

That's why the data resource is there for.

remyleone avatar Sep 27 '22 06:09 remyleone

the data source looks like a workaround. We should consider apply the option StateFunc on the schema

Monitob avatar Sep 27 '22 08:09 Monitob

Close due to ImportStateVerify inconsistency and StateFunc is not recommended to set and ID. More information here

Monitob avatar Oct 19 '22 12:10 Monitob