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

Missing constructor syntax examples for the Pulumi service provider #16191

Closed
arunkumar611 opened this issue May 12, 2024 · 2 comments · Fixed by #16223
Closed

Missing constructor syntax examples for the Pulumi service provider #16191

arunkumar611 opened this issue May 12, 2024 · 2 comments · Fixed by #16223
Assignees
Labels
area/codegen SDK-gen, program-gen, convert kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Milestone

Comments

@arunkumar611
Copy link
Member

https://www.pulumi.com/registry/packages/pulumiservice/api-docs/teamstackpermission/

image
@arunkumar611 arunkumar611 added the needs-triage Needs attention from the triage team label May 12, 2024
@sean1588 sean1588 transferred this issue from pulumi/docs May 13, 2024
@justinvp justinvp added area/codegen SDK-gen, program-gen, convert kind/bug Some behavior is incorrect or out of spec and removed needs-triage Needs attention from the triage team labels May 14, 2024
@justinvp
Copy link
Member

@Zaid-Ajaj, any idea why some of the languages show "Coming soon!" for constructor syntax examples? TS, Python, Go, C# are "Coming soon", but Java and YAML are filled-in.

@justinvp justinvp added this to the 0.104 milestone May 14, 2024
@justinvp justinvp changed the title Update examples for Pulumi service provider Missing constructor syntax examples for the Pulumi service provider May 14, 2024
@Zaid-Ajaj
Copy link
Contributor

The intermediate PCL program generated for TeamStackPermission looks like this:

resource "teamStackPermissionResource" "pulumiservice:index:TeamStackPermission" {
  organization = "string"
  permission = "read"
  project = "string"
  stack = "string"
  team = "string"
}

Where permission is a numeric enum defined as follows{ "read" => 101, "edit" => 102, "admin" => 103 }.

Program-gen for C# fails here, generating a PANIC so this specific example is skipped:

    // Resource pulumiservice:index:TeamStackPermission
    var teamStackPermissionResource = new PulumiService.TeamStackPermission("teamStackPermissionResource", new()
    {
        Organization = "string",
        Permission = %!v(PANIC=Format method: Unsafe enum conversions from type string not implemented yet:  "read"
 => enum(pulumiservice:index:TeamStackPermissionScope(number): cty.NumberIntVal(101),cty.NumberIntVal(102),cty.NumberIntVal(103))),
        Project = "string",
        Stack = "string",
        Team = "string",
    });

TypeScript, Go and Python all fail to a similar error. Fix incoming

@justinvp justinvp modified the milestones: 0.104, 0.105 May 20, 2024
github-merge-queue bot pushed a commit that referenced this issue May 30, 2024
…meric enums as input (#16223)

# Description

Fixes #16191 

The original issue is that the intermediate PCL we generate used enum
names instead of enum values for numeric enum inputs. This PR changes it
so that the PCL program now uses the first numeric value for the first
enum case then subsequently fixing downstream program-gen bugs that
didn't know how to handle numeric values as inputs for enums.

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/codegen SDK-gen, program-gen, convert kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
4 participants