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

PluginFramework tfgen does not respect name overrides for SingleNestedAttribute #2714

Open
t0yv0 opened this issue Dec 10, 2024 · 0 comments
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@t0yv0
Copy link
Member

t0yv0 commented Dec 10, 2024

What happened?

When working on #2440 testing, an issue surfaced that limits the provider author's ability to override Pulumi names for nested configuration properties under Plugin Framework, something that works expected under SDKv2 framework.

Example

Currently causing these test failures:

TestAccProviderConfigureSecretsPluginFramework/explicit-provider/first-class-secret/nested-strlist
TestAccProviderConfigureSecretsPluginFramework/explicit-provider/schema-secret/nested-strlist

It appears that these name overrides are not respected when generating the schema based on an pschema.SingleNestedAttribute.

Under SDKv2 a similar test needs to nest the name overrides under Elem, reflecting the fact that it utilizes a MaxItems=1 encoding with TF objects that have paths like obj.0.nested_strlist_config that is the object is always wrapped by a single-element array in TF. However in this PF example, there is no array wrapping, and paths are direct as in obj.nested_strlist_config. So the example probably should work as-is.

			bp.Config = map[string]*info.Schema{
				"obj": {
					Fields: map[string]*info.Schema{
						"nested_strlist_config": {
							// Prevent nestedStrlistConfigs pluralization
							Name: "nestedStrlistConfig",
						},
						"nested_secret_strlist_config": {
							// Prevent nestedSecretStrlistConfigs pluralization
							Name: "nestedSecretStrlistConfig",
						},
					},
				},
			}
        Diagnostics:
          pulumi:pulumi:Stack (test-test):
            Error: Property nestedStrlistConfig does not exist on 'prov:index/ProviderObj:ProviderObj'
              on Pulumi.yaml line 9:
               9:                                         nestedStrlistConfig:
              10:                                             fn::secret:
              11:                                                 ["A","B"]
            Cannot assign '{obj: {nestedStrlistConfig: List<string>}}' to 'pulumi:providers:prov':
              obj: Cannot assign '{nestedStrlistConfig: List<string>}' to 'prov:index/ProviderObj:ProviderObj':
                Existing properties are: nestedStrlistConfigs, nestedStringConfig, nestedBoolConfig, nestedIntConfig, nestedSecretIntConfig and 3 others

Output of pulumi about

https://github.com/pulumi/pulumi-terraform-bridge/releases/tag/v3.97.1 is affected.

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).

@t0yv0 t0yv0 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Dec 10, 2024
@t0yv0 t0yv0 self-assigned this Dec 10, 2024
@iwahbe iwahbe removed the needs-triage Needs attention from the triage team label Dec 11, 2024
t0yv0 added a commit that referenced this issue Dec 11, 2024
…providers (#2716)

Adds tests for Plugin Framework to cover the treatment of passing
secrets or ensuring sensitive data in provider configuration. This
completes the requirements for #2440 testing.

Fixes #2440 

Two issues were discovered in this work that result in skipped tests
until we can fix them:

- #2715
- #2714
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