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

Add code snippets for common Pulumi Boilerplate #15

Open
zbuchheit opened this issue Oct 17, 2024 · 1 comment
Open

Add code snippets for common Pulumi Boilerplate #15

zbuchheit opened this issue Oct 17, 2024 · 1 comment
Labels
kind/enhancement Improvements or new features

Comments

@zbuchheit
Copy link

zbuchheit commented Oct 17, 2024

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

It would be nice as part of the vscode extension to get some code snippets. For example having a snippet for component resources or dynamic resources would save time and make it easier on users. It would also help to guide them in best practices.

Example Typescript Component Resource Code Snippet
{
	"Pulumi Component Resource": {
		"prefix": "pulumi-component",
		"body": [
			"import * as pulumi from '@pulumi/pulumi';",
			"",
			"export interface ${1:ComponentResourceArgs} {",
			"  ${2:property1}?: pulumi.Input<string>;",
			"  ${3:property2}?: pulumi.Input<number>;",
			"}",
			"",
			"export class ${4:MyComponentResource} extends pulumi.ComponentResource {",
			"  public readonly ${5:outputProperty}: pulumi.Output<string>;",
			"",
			"  constructor(name: string, args: ${1:ComponentResourceArgs}, opts?: pulumi.CustomResourceOptions) {",
			"    super('${6:my:module:ComponentResource}', name, {}, opts);",
			"",
			"    // Example of using the args to define resources",
			"    const exampleResource = new pulumi.resource.${7:SomeResource}('${8:exampleResource}', {",
			"      ${2:property1}: args.${2:property1},",
			"    }, { parent: this });",
			"",
			"    // Example of exporting a property from the component",
			"    this.${5:outputProperty} = pulumi.output('${9:some-output-value}');",
			"",
			"    this.registerOutputs({",
			"      ${5:outputProperty}: this.${5:outputProperty}",
			"    });",
			"  }",
			"}"
		],
		"description": "Pulumi TypeScript Component Resource template"
	}
}

Affected area/feature

@zbuchheit zbuchheit added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Oct 17, 2024
@mjeffryes mjeffryes removed the needs-triage Needs attention from the triage team label Oct 29, 2024
@mhmdio
Copy link

mhmdio commented Oct 30, 2024

Today, I wrote my first component, this would be nice to have

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

3 participants