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

Pulumi-inexpressible values after MaxItemsOne flattening under ConfigModeAttr #2025

Open
VenelinMartinov opened this issue May 23, 2024 · 1 comment
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@VenelinMartinov
Copy link
Contributor

VenelinMartinov commented May 23, 2024

What happened?

Combining MaxItemsOne with ConfigModeAttr yields inexpressible values in pulumi land because of MaxItemsOne flattening.

Azure classic is a provider which uses ConfigModeAttr quite a bit so might be a good place to look for examples of real world usage.

Example

schema:

"f0": {
	Optional:   true,
	Type:       schema.TypeList,
	MaxItems:   1,
	ConfigMode: schema.SchemaConfigModeAttr,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"x": {Optional: true, Type: schema.TypeString},
		},
	},
}

in terraform we can pass:

resource "crossprovider_testres" "example" {
  f0 = []
}

but on pulumi side we can either not specify it, pass x=nil or x=non-nil.

These map to nil, nil, and non-nil respectively but none of them map to [].

Output of pulumi about

.

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@VenelinMartinov VenelinMartinov added the kind/bug Some behavior is incorrect or out of spec label May 23, 2024
@VenelinMartinov VenelinMartinov changed the title Inexpressible values after MaxItemsOne flattening under ConfigModeAttr Pulumi-inexpressible values after MaxItemsOne flattening under ConfigModeAttr May 28, 2024
@t0yv0
Copy link
Member

t0yv0 commented Jul 19, 2024

Yes, somewhat of a known unfortunate issue, thanks for documenting this. This would benefit from fully worked examples and impact. For an attribute of this type:

TF has 5 unknown, nil, [], [{"foo": "bar"}] states.

Pulumi has 4 unknown, nil, {"foo": "bar"} states.

We cannot turnaround or map 1:1, but we can decide whether Pulumi nil should map to nil or to [], how does it map currently, and what are the trade-offs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants