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

GetOkExists returns false during create when empty value is specified for List type #116

Closed
parweza opened this issue Aug 29, 2018 · 6 comments
Labels
enhancement New feature or request

Comments

@parweza
Copy link

parweza commented Aug 29, 2018

HI,
GetOkExists returns false during create when empty value is specified for List type. Because of that We are not able differentiate whether customer has omitted this field in tf config or has provided empty value.

resource "oci_file_storage_export" "my_export_fs1_mt1" {
  #Required
  export_set_id  = "${oci_file_storage_export_set.my_export_set_1.id}"
  file_system_id = "${oci_file_storage_file_system.my_fs_1.id}"
  path           = "${var.export_path_fs1_mt1}"

  export_options = [
  ]
}

with above config we are expecting to get true for ok onhttps://github.com/oracle/terraform-provider-oci/blob/master/provider/file_storage_export_resource.go#L177
but we are getting false.
Can you please look into it?

Thanks,
Parwez

Terraform Version

0.10.8

Terraform Configuration Files

...

Debug Output

Crash Output

Expected Behavior

Actual Behavior

Steps to Reproduce

Additional Context

References

@jbardin
Copy link
Member

jbardin commented Aug 30, 2018

Hi @parweza,

Sorry about the confusion here, but this is working as expected. From the GetOkExists docs, you can see:

This is only useful for determining if boolean attributes have been set, if they are Optional but do not have a Default value

There is no notion of "unset" in the current schema packages. We are working on new protocol and configuration packages that will support this in the future, but for now the zero values can't be differentiated from unset in the in config.

@parweza
Copy link
Author

parweza commented Sep 4, 2018

@jbardin
what is recommended way differentiating the cases when user has omitted the property and when provided empty value?
we need to model
export options in https://docs.cloud.oracle.com/iaas/api/#/en/filestorage/20171215/datatypes/CreateExportDetails

@jbardin
Copy link
Member

jbardin commented Sep 5, 2018

@parweza,

Unfortunately there is not currently a method for determining this in all cases. We are in the process of updating the configuration language to support this feature, but it's going to be some time before it's fully supported in the provider sdk.

In the meantime, this usually requires the use of a sentinel value for the empty set, or another option field to indicate that the user wants to set no export options.

@mingfang
Copy link

any update on this?

@hashibot hashibot transferred this issue from hashicorp/terraform Sep 26, 2019
@hashibot hashibot added the enhancement New feature or request label Oct 2, 2019
@paultyng
Copy link
Contributor

This will most likely be solved by #261 given explicit access to Unknown vs empty list and #133 which will provide direct access to config values. Closing in favor of those.

@ghost
Copy link

ghost commented Dec 26, 2019

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Dec 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants