Snippet resource
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as scm from "@pulumi/scm";
const scmLabel1 = new scm.Label("scm_label_1", {name: "scm_label"});
//snippet with label
const scmSnippet1 = new scm.Snippet("scm_snippet_1", {
name: "scm_snippet",
description: "Adding a Description from Terraform",
labels: [scmLabel1.name],
});
const scmSnippet2 = new scm.Snippet("scm_snippet_2", {
name: "scm_snippet_2",
description: "Adding a Description from Terraform",
});
const scmSnippet3 = new scm.Snippet("scm_snippet_3", {
name: "scm_snippet_3",
description: "Adding a Description from Terraform",
});
import pulumi
import pulumi_scm as scm
scm_label1 = scm.Label("scm_label_1", name="scm_label")
#snippet with label
scm_snippet1 = scm.Snippet("scm_snippet_1",
name="scm_snippet",
description="Adding a Description from Terraform",
labels=[scm_label1.name])
scm_snippet2 = scm.Snippet("scm_snippet_2",
name="scm_snippet_2",
description="Adding a Description from Terraform")
scm_snippet3 = scm.Snippet("scm_snippet_3",
name="scm_snippet_3",
description="Adding a Description from Terraform")
package main
import (
"github.com/pulumi/pulumi-scm/sdk/go/scm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
scmLabel1, err := scm.NewLabel(ctx, "scm_label_1", &scm.LabelArgs{
Name: pulumi.String("scm_label"),
})
if err != nil {
return err
}
// snippet with label
_, err = scm.NewSnippet(ctx, "scm_snippet_1", &scm.SnippetArgs{
Name: pulumi.String("scm_snippet"),
Description: pulumi.String("Adding a Description from Terraform"),
Labels: pulumi.StringArray{
scmLabel1.Name,
},
})
if err != nil {
return err
}
_, err = scm.NewSnippet(ctx, "scm_snippet_2", &scm.SnippetArgs{
Name: pulumi.String("scm_snippet_2"),
Description: pulumi.String("Adding a Description from Terraform"),
})
if err != nil {
return err
}
_, err = scm.NewSnippet(ctx, "scm_snippet_3", &scm.SnippetArgs{
Name: pulumi.String("scm_snippet_3"),
Description: pulumi.String("Adding a Description from Terraform"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scm = Pulumi.Scm;
return await Deployment.RunAsync(() =>
{
var scmLabel1 = new Scm.Label("scm_label_1", new()
{
Name = "scm_label",
});
//snippet with label
var scmSnippet1 = new Scm.Snippet("scm_snippet_1", new()
{
Name = "scm_snippet",
Description = "Adding a Description from Terraform",
Labels = new[]
{
scmLabel1.Name,
},
});
var scmSnippet2 = new Scm.Snippet("scm_snippet_2", new()
{
Name = "scm_snippet_2",
Description = "Adding a Description from Terraform",
});
var scmSnippet3 = new Scm.Snippet("scm_snippet_3", new()
{
Name = "scm_snippet_3",
Description = "Adding a Description from Terraform",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scm.Label;
import com.pulumi.scm.LabelArgs;
import com.pulumi.scm.Snippet;
import com.pulumi.scm.SnippetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var scmLabel1 = new Label("scmLabel1", LabelArgs.builder()
.name("scm_label")
.build());
//snippet with label
var scmSnippet1 = new Snippet("scmSnippet1", SnippetArgs.builder()
.name("scm_snippet")
.description("Adding a Description from Terraform")
.labels(scmLabel1.name())
.build());
var scmSnippet2 = new Snippet("scmSnippet2", SnippetArgs.builder()
.name("scm_snippet_2")
.description("Adding a Description from Terraform")
.build());
var scmSnippet3 = new Snippet("scmSnippet3", SnippetArgs.builder()
.name("scm_snippet_3")
.description("Adding a Description from Terraform")
.build());
}
}
resources:
scmLabel1:
type: scm:Label
name: scm_label_1
properties:
name: scm_label
# snippet with label
scmSnippet1:
type: scm:Snippet
name: scm_snippet_1
properties:
name: scm_snippet
description: Adding a Description from Terraform
labels:
- ${scmLabel1.name}
scmSnippet2:
type: scm:Snippet
name: scm_snippet_2
properties:
name: scm_snippet_2
description: Adding a Description from Terraform
scmSnippet3:
type: scm:Snippet
name: scm_snippet_3
properties:
name: scm_snippet_3
description: Adding a Description from Terraform
Create Snippet Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Snippet(name: string, args?: SnippetArgs, opts?: CustomResourceOptions);@overload
def Snippet(resource_name: str,
args: Optional[SnippetArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Snippet(resource_name: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
labels: Optional[Sequence[str]] = None,
name: Optional[str] = None,
type: Optional[str] = None)func NewSnippet(ctx *Context, name string, args *SnippetArgs, opts ...ResourceOption) (*Snippet, error)public Snippet(string name, SnippetArgs? args = null, CustomResourceOptions? opts = null)
public Snippet(String name, SnippetArgs args)
public Snippet(String name, SnippetArgs args, CustomResourceOptions options)
type: scm:Snippet
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args SnippetArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args SnippetArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SnippetArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SnippetArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SnippetArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var snippetResource = new Scm.Snippet("snippetResource", new()
{
Description = "string",
Labels = new[]
{
"string",
},
Name = "string",
Type = "string",
});
example, err := scm.NewSnippet(ctx, "snippetResource", &scm.SnippetArgs{
Description: pulumi.String("string"),
Labels: pulumi.StringArray{
pulumi.String("string"),
},
Name: pulumi.String("string"),
Type: pulumi.String("string"),
})
var snippetResource = new Snippet("snippetResource", SnippetArgs.builder()
.description("string")
.labels("string")
.name("string")
.type("string")
.build());
snippet_resource = scm.Snippet("snippetResource",
description="string",
labels=["string"],
name="string",
type="string")
const snippetResource = new scm.Snippet("snippetResource", {
description: "string",
labels: ["string"],
name: "string",
type: "string",
});
type: scm:Snippet
properties:
description: string
labels:
- string
name: string
type: string
Snippet Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Snippet resource accepts the following input properties:
- Description string
- The description of the snippet
- Labels List<string>
- Labels applied to the snippet
- Name string
- The name of the snippet
- Type string
- The snippet type
- Description string
- The description of the snippet
- Labels []string
- Labels applied to the snippet
- Name string
- The name of the snippet
- Type string
- The snippet type
- description String
- The description of the snippet
- labels List<String>
- Labels applied to the snippet
- name String
- The name of the snippet
- type String
- The snippet type
- description string
- The description of the snippet
- labels string[]
- Labels applied to the snippet
- name string
- The name of the snippet
- type string
- The snippet type
- description str
- The description of the snippet
- labels Sequence[str]
- Labels applied to the snippet
- name str
- The name of the snippet
- type str
- The snippet type
- description String
- The description of the snippet
- labels List<String>
- Labels applied to the snippet
- name String
- The name of the snippet
- type String
- The snippet type
Outputs
All input properties are implicitly available as output properties. Additionally, the Snippet resource produces the following output properties:
Look up Existing Snippet Resource
Get an existing Snippet resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: SnippetState, opts?: CustomResourceOptions): Snippet@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
labels: Optional[Sequence[str]] = None,
name: Optional[str] = None,
tfid: Optional[str] = None,
type: Optional[str] = None) -> Snippetfunc GetSnippet(ctx *Context, name string, id IDInput, state *SnippetState, opts ...ResourceOption) (*Snippet, error)public static Snippet Get(string name, Input<string> id, SnippetState? state, CustomResourceOptions? opts = null)public static Snippet get(String name, Output<String> id, SnippetState state, CustomResourceOptions options)resources: _: type: scm:Snippet get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Description string
- The description of the snippet
- Labels List<string>
- Labels applied to the snippet
- Name string
- The name of the snippet
- Tfid string
- Type string
- The snippet type
- Description string
- The description of the snippet
- Labels []string
- Labels applied to the snippet
- Name string
- The name of the snippet
- Tfid string
- Type string
- The snippet type
- description String
- The description of the snippet
- labels List<String>
- Labels applied to the snippet
- name String
- The name of the snippet
- tfid String
- type String
- The snippet type
- description string
- The description of the snippet
- labels string[]
- Labels applied to the snippet
- name string
- The name of the snippet
- tfid string
- type string
- The snippet type
- description str
- The description of the snippet
- labels Sequence[str]
- Labels applied to the snippet
- name str
- The name of the snippet
- tfid str
- type str
- The snippet type
- description String
- The description of the snippet
- labels List<String>
- Labels applied to the snippet
- name String
- The name of the snippet
- tfid String
- type String
- The snippet type
Package Details
- Repository
- scm pulumi/pulumi-scm
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
scmTerraform Provider.
