https://pulumi.com logo
Join the conversationJoin Slack
Channels
announcements
automation-api
aws
azure
blog-posts
built-with-pulumi
cloudengineering
cloudengineering-support
content-share
contribex
contribute
docs
dotnet
finops
general
getting-started
gitlab
golang
google-cloud
hackathon-03-19-2020
hacktoberfest
install
java
jobs
kubernetes
learn-pulumi-events
linen
localstack
multi-language-hackathon
office-hours
oracle-cloud-infrastructure
plugin-framework
pulumi-cdk
pulumi-crosscode
pulumi-deployments
pulumi-kubernetes-operator
pulumi-service
pulumiverse
python
registry
status
testingtesting123
testingtesting321
typescript
welcome
workshops
yaml
Powered by Linen
typescript
  • b

    broad-dog-22463

    08/05/2019, 8:40 AM
    is checking now
  • g

    glamorous-waitress-51149

    08/05/2019, 8:40 AM
  • b

    broad-dog-22463

    08/05/2019, 8:41 AM
    oh that's not us actually
  • b

    broad-dog-22463

    08/05/2019, 8:41 AM
    that's a TF thing
  • b

    broad-dog-22463

    08/05/2019, 8:42 AM
    There is no Lambda target supported in TF
  • b

    broad-dog-22463

    08/05/2019, 8:42 AM
    checking the SDK
  • b

    broad-dog-22463

    08/05/2019, 8:42 AM
    one sec
  • g

    glamorous-waitress-51149

    08/05/2019, 8:42 AM
    cheers
  • b

    broad-dog-22463

    08/05/2019, 8:43 AM
    No sir. The SDK doesn't support a Lambda target
  • b

    broad-dog-22463

    08/05/2019, 8:43 AM
    type Target struct {
    	_ struct{} `type:"structure"`
    
    	// The Amazon Resource Name (ARN) of the target.
    	//
    	// Arn is a required field
    	Arn *string `min:"1" type:"string" required:"true"`
    
    	// If the event target is an AWS Batch job, this contains the job definition,
    	// job name, and other parameters. For more information, see Jobs (<https://docs.aws.amazon.com/batch/latest/userguide/jobs.html>)
    	// in the AWS Batch User Guide.
    	BatchParameters *BatchParameters `type:"structure"`
    
    	// Contains the Amazon ECS task definition and task count to be used if the
    	// event target is an Amazon ECS task. For more information about Amazon ECS
    	// tasks, see Task Definitions (<https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html>)
    	// in the Amazon EC2 Container Service Developer Guide.
    	EcsParameters *EcsParameters `type:"structure"`
    
    	// The ID of the target.
    	//
    	// Id is a required field
    	Id *string `min:"1" type:"string" required:"true"`
    
    	// Valid JSON text passed to the target. In this case, nothing from the event
    	// itself is passed to the target. For more information, see The JavaScript
    	// Object Notation (JSON) Data Interchange Format (<http://www.rfc-editor.org/rfc/rfc7159.txt>).
    	Input *string `type:"string"`
    
    	// The value of the JSONPath that is used for extracting part of the matched
    	// event when passing it to the target. You must use JSON dot notation, not
    	// bracket notation. For more information about JSON paths, see JSONPath (<http://goessner.net/articles/JsonPath/>).
    	InputPath *string `type:"string"`
    
    	// Settings to enable you to provide custom input to a target based on certain
    	// event data. You can extract one or more key-value pairs from the event and
    	// then use that data to send customized input to the target.
    	InputTransformer *InputTransformer `type:"structure"`
    
    	// The custom parameter that you can use to control the shard assignment when
    	// the target is a Kinesis data stream. If you don't include this parameter,
    	// the default is to use the eventId as the partition key.
    	KinesisParameters *KinesisParameters `type:"structure"`
    
    	// The Amazon Resource Name (ARN) of the IAM role to be used for this target
    	// when the rule is triggered. If one rule triggers multiple targets, you can
    	// use a different IAM role for each target.
    	RoleArn *string `min:"1" type:"string"`
    
    	// Parameters used when you are using the rule to invoke Amazon EC2 Run Command.
    	RunCommandParameters *RunCommandParameters `type:"structure"`
    
    	// Contains the message group ID to use when the target is a FIFO queue.
    	//
    	// If you specify an SQS FIFO queue as a target, the queue must have content-based
    	// deduplication enabled.
    	SqsParameters *SqsParameters `type:"structure"`
    }
  • g

    glamorous-waitress-51149

    08/05/2019, 8:43 AM
    hmm, was also reading https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_target.html
  • b

    broad-dog-22463

    08/05/2019, 8:45 AM
    does it support a Lambda via the AWS Console?
  • g

    glamorous-waitress-51149

    08/05/2019, 8:45 AM
    yup
  • g

    glamorous-waitress-51149

    08/05/2019, 8:45 AM
  • b

    broad-dog-22463

    08/05/2019, 8:46 AM
    input - (Optional) Valid JSON text passed to the target.
  • b

    broad-dog-22463

    08/05/2019, 8:46 AM
    your input isn;'t correct
  • b

    broad-dog-22463

    08/05/2019, 8:46 AM
    We (Pulumi) don't validate that
  • b

    broad-dog-22463

    08/05/2019, 8:46 AM
    so it's probably failing in AWS validation
  • g

    glamorous-waitress-51149

    08/05/2019, 8:46 AM
    i kept that out in my example for brevity
  • b

    broad-dog-22463

    08/05/2019, 8:46 AM
    ah so you have valid JSON as well
  • g

    glamorous-waitress-51149

    08/05/2019, 8:46 AM
    see screenshot - shows the actual json in the manually created one
  • b

    broad-dog-22463

    08/05/2019, 8:46 AM
    oh there we go!
  • b

    broad-dog-22463

    08/05/2019, 8:46 AM
    Note: In order to be able to have your AWS Lambda function or SNS topic invoked by a CloudWatch Events rule, you must setup the right permissions using aws_lambda_permission or aws_sns_topic.policy. More info here.
  • g

    glamorous-waitress-51149

    08/05/2019, 8:47 AM
    manual one is working as hoped, thought i’d now try and script it
  • b

    broad-dog-22463

    08/05/2019, 8:47 AM
    you need to have an aws_lambda_permission in place to allow access to it
    s
    g
    s
    • 4
    • 15
  • b

    broad-dog-22463

    08/05/2019, 8:47 AM
    https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/resource-based-policies-cwe.html
  • t

    thankful-optician-22583

    08/05/2019, 4:21 PM
    Hi if anyone does have insight on how to pass in aws credentials to a ‘’'@pulumi/kubernetes’‘' object, please help. I have succesfully uploaded an image to ecr using ‘’'pulumi/docker.Images’’'
    const image = new docker.Image(applicationName, {
        imageName: config.require("ecr-server"),
        build: "./app",
        registry: {
            server: config.require("ecr-server"),
            username: config.require("ecr-username"),
            password: config.require("ecr-password")
        }
    });
    But when I want to use it for deployment of Kubernetes I notice there is a
    ImagePullBackOff
    error.
    const deployment = new k8s.apps.v1.Deployment(applicationName, {
        apiVersion: "apps/v1",
        kind: "Deployment",
                metadata: {
                name: applicationName
            },
        spec: {
            selector: { matchLabels: appLabels },
            template: {
                metadata: { labels: appLabels },
                spec: {
                    containers: [
                        {
                            name: applicationName,
                            image: image.imageName
                        }
                    ]
                }
            }
        }
    });
    When I investigated further using
    kubectl describe po
    I see this error
    Failed to pull image "IMAGE": rpc error: code = Unknown desc = Error response from daemon: Get https//IMAGE: no basic auth credentials
    How do i pass in the aws credentials to the “pulumi/kubernetes” object so that the deployment has access to the ecr?
    h
    • 2
    • 3
  • s

    salmon-account-74572

    08/07/2019, 3:01 PM
    TypeScript newbie here, so forgive the simple question. The example usage for the
    getAvailabilityZones
    function in
    pulumi/@aws
    shows the use of the
    output
    function to access the data returned by the function. However, the only way I was able to make it work was without the
    output
    function, like so:
    const rawAzInfo = aws.getAvailabilityZones({
        state: "available",
    });
    let azNames: Array<string> = rawAzInfo.names;
    let numberOfAZs: number = azNames.length;
    Am I missing/overlooking/not understanding something? Or is this an error in the docs?
    w
    • 2
    • 4
  • b

    boundless-monkey-50243

    08/07/2019, 6:01 PM
    Is there a way to get details on why packages are being pulled into an
    aws.lambda.CallbackFunction
    ? Pulumi's own packages are being transitively included somehow (I am legit unclear as to why, as while some types from
    @pulumi/aws
    are being used there is no code being used) and I can't seem to adequately exclude them via
    codePathOptions
    .
  • s

    salmon-account-74572

    08/07/2019, 6:46 PM
    Another TS newbie question: how does one specify a value for the type of instance to create, and then re-use that value multiple times? For example:
    let bastionType = "t2.small";
    let bastion_instance = new aws.ec2.Instance("bastion", {
        instanceType = bastionType,
    });
    This doesn't work (
    instanceType
    requires type Input, but I can't seem to declare my variable as that type).
    b
    • 2
    • 4
Powered by Linen
Title
s

salmon-account-74572

08/07/2019, 6:46 PM
Another TS newbie question: how does one specify a value for the type of instance to create, and then re-use that value multiple times? For example:
let bastionType = "t2.small";
let bastion_instance = new aws.ec2.Instance("bastion", {
    instanceType = bastionType,
});
This doesn't work (
instanceType
requires type Input, but I can't seem to declare my variable as that type).
b

broad-dog-22463

08/07/2019, 6:50 PM
Can you declare your bastionType as:
let bastionType = aws.ec2.InstanceTypes.T2_Small
and then use that?
s

salmon-account-74572

08/07/2019, 6:52 PM
Ah, that's got it. I saw the reference to
aws.ec2.InstanceTypes
but wasn't sure exactly how to use it (for example, I tried declaring the type of "bastionType" as that, but that didn't work). Thank you!
b

broad-dog-22463

08/07/2019, 6:54 PM
👍
View count: 1