-
Notifications
You must be signed in to change notification settings - Fork 31
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
Crash when creating ldap object with computed attribute value #6
Comments
philsttr
pushed a commit
to philsttr/terraform
that referenced
this issue
Jan 5, 2018
…computed. This fixes a problem for fields of type `schema.TypeSet`, whose elements are of type `schema.TypeMap`, whose elements are computed. For example, consider the following schema... ``` "maps": &schema.Schema{ Type: schema.TypeSet, Set: mapHash, MinItems: 0, Elem: &schema.Schema{ Type: schema.TypeMap, MinItems: 1, MaxItems: 1, Elem: &schema.Schema{ Type: schema.TypeString, }, }, Optional: true, }, ``` Note that the `mapHash` function determines the unique ID of an item (a map) so that a proper set can be built. Without this change, the `mapHash` function will be passed `nil` for computed maps (since field_reader.ReadField returns null for maps with computed entries). A proper hash for `nil` cannot be accurately determined. You could theoretically always return the same value, but that breaks downstream logic that assumes each element will have a unique hash. With this change, since the list is marked as computed, `mapHash` is not invoked for each element. This is causing Pryz/terraform-provider-ldap#6
Tracked this down to a potential problem in terraform. I've submitted a PR (hashicorp/terraform#17049) to hopefully fix. |
philsttr
pushed a commit
to philsttr/terraform
that referenced
this issue
Jan 8, 2018
…computed. This fixes a problem for fields of type `schema.TypeSet`, whose elements are of type `schema.TypeMap`, whose elements are computed. For example, consider the following schema... ``` "maps": &schema.Schema{ Type: schema.TypeSet, Set: mapHash, MinItems: 0, Elem: &schema.Schema{ Type: schema.TypeMap, MinItems: 1, MaxItems: 1, Elem: &schema.Schema{ Type: schema.TypeString, }, }, Optional: true, }, ``` Note that the `mapHash` function determines the unique ID of an item (a map) so that a proper set can be built. Without this change, the `mapHash` function will be passed `nil` for computed maps (since field_reader.ReadField returns null for maps with computed entries). A proper hash for `nil` cannot be accurately determined. You could theoretically always return the same value, but that breaks downstream logic that assumes each element will have a unique hash. With this change, since the list is marked as computed, `mapHash` is not invoked for each element. This is causing Pryz/terraform-provider-ldap#6
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The terraform-provider-ldap crashes if an ldap_object attribute's value is derived from a computed value.
For example, I have taken the example given in the README.md, and changed the uid/gid attribute values to be computed values (from a random integer) as follows
Running terraform plan will give the following error:
crash.log
This works fine if I change the uid/gid back to static values. I only see the crash when they are computed values.
terraform v0.10.8
centos 7.4
The text was updated successfully, but these errors were encountered: