1. Packages
  2. Harness Provider
  3. API Docs
  4. service
  5. Lambda
Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi

harness.service.Lambda

Explore with Pulumi AI

harness logo
Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi

    Resource for creating an AWS Lambda service. This resource uses the config-as-code API’s. When updating the name or path of this resource you should typically also set the create_before_destroy = true lifecycle setting.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@pulumi/harness";
    
    const example = new harness.Application("example", {name: "example"});
    const exampleLambda = new harness.service.Lambda("example", {
        appId: example.id,
        name: "my-lambda-service",
        description: "Service for deploying AWS Lambda functions.",
    });
    
    import pulumi
    import pulumi_harness as harness
    
    example = harness.Application("example", name="example")
    example_lambda = harness.service.Lambda("example",
        app_id=example.id,
        name="my-lambda-service",
        description="Service for deploying AWS Lambda functions.")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-harness/sdk/go/harness"
    	"github.com/pulumi/pulumi-harness/sdk/go/harness/service"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := harness.NewApplication(ctx, "example", &harness.ApplicationArgs{
    			Name: pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = service.NewLambda(ctx, "example", &service.LambdaArgs{
    			AppId:       example.ID(),
    			Name:        pulumi.String("my-lambda-service"),
    			Description: pulumi.String("Service for deploying AWS Lambda functions."),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Harness = Pulumi.Harness;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Harness.Application("example", new()
        {
            Name = "example",
        });
    
        var exampleLambda = new Harness.Service.Lambda("example", new()
        {
            AppId = example.Id,
            Name = "my-lambda-service",
            Description = "Service for deploying AWS Lambda functions.",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.harness.Application;
    import com.pulumi.harness.ApplicationArgs;
    import com.pulumi.harness.service.Lambda;
    import com.pulumi.harness.service.LambdaArgs;
    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 example = new Application("example", ApplicationArgs.builder()
                .name("example")
                .build());
    
            var exampleLambda = new Lambda("exampleLambda", LambdaArgs.builder()
                .appId(example.id())
                .name("my-lambda-service")
                .description("Service for deploying AWS Lambda functions.")
                .build());
    
        }
    }
    
    resources:
      example:
        type: harness:Application
        properties:
          name: example
      exampleLambda:
        type: harness:service:Lambda
        name: example
        properties:
          appId: ${example.id}
          name: my-lambda-service
          description: Service for deploying AWS Lambda functions.
    

    Create Lambda Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Lambda(name: string, args: LambdaArgs, opts?: CustomResourceOptions);
    @overload
    def Lambda(resource_name: str,
               args: LambdaArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Lambda(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               app_id: Optional[str] = None,
               description: Optional[str] = None,
               name: Optional[str] = None,
               variables: Optional[Sequence[LambdaVariableArgs]] = None)
    func NewLambda(ctx *Context, name string, args LambdaArgs, opts ...ResourceOption) (*Lambda, error)
    public Lambda(string name, LambdaArgs args, CustomResourceOptions? opts = null)
    public Lambda(String name, LambdaArgs args)
    public Lambda(String name, LambdaArgs args, CustomResourceOptions options)
    
    type: harness:service:Lambda
    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 LambdaArgs
    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 LambdaArgs
    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 LambdaArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LambdaArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LambdaArgs
    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 lambdaResource = new Harness.Service.Lambda("lambdaResource", new()
    {
        AppId = "string",
        Description = "string",
        Name = "string",
        Variables = new[]
        {
            new Harness.Service.Inputs.LambdaVariableArgs
            {
                Name = "string",
                Type = "string",
                Value = "string",
            },
        },
    });
    
    example, err := service.NewLambda(ctx, "lambdaResource", &service.LambdaArgs{
    	AppId:       pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    	Variables: service.LambdaVariableArray{
    		&service.LambdaVariableArgs{
    			Name:  pulumi.String("string"),
    			Type:  pulumi.String("string"),
    			Value: pulumi.String("string"),
    		},
    	},
    })
    
    var lambdaResource = new Lambda("lambdaResource", LambdaArgs.builder()
        .appId("string")
        .description("string")
        .name("string")
        .variables(LambdaVariableArgs.builder()
            .name("string")
            .type("string")
            .value("string")
            .build())
        .build());
    
    lambda_resource = harness.service.Lambda("lambdaResource",
        app_id="string",
        description="string",
        name="string",
        variables=[{
            "name": "string",
            "type": "string",
            "value": "string",
        }])
    
    const lambdaResource = new harness.service.Lambda("lambdaResource", {
        appId: "string",
        description: "string",
        name: "string",
        variables: [{
            name: "string",
            type: "string",
            value: "string",
        }],
    });
    
    type: harness:service:Lambda
    properties:
        appId: string
        description: string
        name: string
        variables:
            - name: string
              type: string
              value: string
    

    Lambda 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 Lambda resource accepts the following input properties:

    AppId string
    The id of the application the service belongs to
    Description string
    Description of th service
    Name string
    Name of the service
    Variables List<LambdaVariable>
    Variables to be used in the service
    AppId string
    The id of the application the service belongs to
    Description string
    Description of th service
    Name string
    Name of the service
    Variables []LambdaVariableArgs
    Variables to be used in the service
    appId String
    The id of the application the service belongs to
    description String
    Description of th service
    name String
    Name of the service
    variables List<LambdaVariable>
    Variables to be used in the service
    appId string
    The id of the application the service belongs to
    description string
    Description of th service
    name string
    Name of the service
    variables LambdaVariable[]
    Variables to be used in the service
    app_id str
    The id of the application the service belongs to
    description str
    Description of th service
    name str
    Name of the service
    variables Sequence[LambdaVariableArgs]
    Variables to be used in the service
    appId String
    The id of the application the service belongs to
    description String
    Description of th service
    name String
    Name of the service
    variables List<Property Map>
    Variables to be used in the service

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Lambda resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Lambda Resource

    Get an existing Lambda 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?: LambdaState, opts?: CustomResourceOptions): Lambda
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            app_id: Optional[str] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            variables: Optional[Sequence[LambdaVariableArgs]] = None) -> Lambda
    func GetLambda(ctx *Context, name string, id IDInput, state *LambdaState, opts ...ResourceOption) (*Lambda, error)
    public static Lambda Get(string name, Input<string> id, LambdaState? state, CustomResourceOptions? opts = null)
    public static Lambda get(String name, Output<String> id, LambdaState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    AppId string
    The id of the application the service belongs to
    Description string
    Description of th service
    Name string
    Name of the service
    Variables List<LambdaVariable>
    Variables to be used in the service
    AppId string
    The id of the application the service belongs to
    Description string
    Description of th service
    Name string
    Name of the service
    Variables []LambdaVariableArgs
    Variables to be used in the service
    appId String
    The id of the application the service belongs to
    description String
    Description of th service
    name String
    Name of the service
    variables List<LambdaVariable>
    Variables to be used in the service
    appId string
    The id of the application the service belongs to
    description string
    Description of th service
    name string
    Name of the service
    variables LambdaVariable[]
    Variables to be used in the service
    app_id str
    The id of the application the service belongs to
    description str
    Description of th service
    name str
    Name of the service
    variables Sequence[LambdaVariableArgs]
    Variables to be used in the service
    appId String
    The id of the application the service belongs to
    description String
    Description of th service
    name String
    Name of the service
    variables List<Property Map>
    Variables to be used in the service

    Supporting Types

    LambdaVariable, LambdaVariableArgs

    Name string
    Name of the variable
    Type string
    Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
    Value string
    Value of the variable
    Name string
    Name of the variable
    Type string
    Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
    Value string
    Value of the variable
    name String
    Name of the variable
    type String
    Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
    value String
    Value of the variable
    name string
    Name of the variable
    type string
    Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
    value string
    Value of the variable
    name str
    Name of the variable
    type str
    Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
    value str
    Value of the variable
    name String
    Name of the variable
    type String
    Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
    value String
    Value of the variable

    Import

    Import using the Harness application id and service id

    $ pulumi import harness:service/lambda:Lambda example <app_id>/<svc_id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    harness pulumi/pulumi-harness
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the harness Terraform Provider.
    harness logo
    Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi