softlayer / terraform-provider-softlayer

a Terraform (http://terraform.io) provider for interacting with SoftLayer (https://www.softlayer.com)
Mozilla Public License 2.0
40 stars 26 forks source link

'fixed_config_preset' forced required breaks 'import' #153

Closed cbrinker closed 7 years ago

cbrinker commented 7 years ago

The 'fixed_config_preset' option on bare_metal resource is preventing me from importing my pre-existing resources into the terraform state file.

https://github.com/softlayer/terraform-provider-softlayer/blob/master/softlayer/resource_softlayer_bare_metal.go#L157

The core problem is that when I issue a terraform import softlayer_bare_metal.aname ID the entry that is imported contains an empty string. When I attempt to adjust this by filling in a value in a .tf file, leads to terraform plan deciding it needs to force a new resource:

    fixed_config_preset:  "" => "S1270_32GB_1X1TBSATA_NORAID" (forces new resource)

The underlying API doesn't look to have this as a required variable: http://sldn.softlayer.com/reference/services/SoftLayer_Hardware/createObject so, can we relax this validation?

athak commented 7 years ago

@cbrinker we have left that parameter as "" in our .tf files without issues.

renier commented 7 years ago

@cbrinker Only bare metals with a fixed config preset are supported currently.

Does athak's fix work for you?

cbrinker commented 7 years ago

@renier yes, specifying an empty string does allow terraform to function. Can this workaround be added to the documentation so future users don't hit the same problem?

Thanks, Chris

renier commented 7 years ago

marking as a FAQ to allow others to filter on and find in the future.