https://pulumi.com logo
Docs
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
golang
  • i

    incalculable-sundown-82514

    09/20/2018, 5:42 PM
    Looks like the
    Role
    argument should be
    Role.ARN()
    ?
  • a

    aloof-tailor-93191

    09/20/2018, 5:42 PM
    needed to pass the arn, not the name of the role
  • a

    aloof-tailor-93191

    09/20/2018, 5:42 PM
    yeah
  • i

    incalculable-sundown-82514

    09/20/2018, 5:42 PM
    yeah
  • i

    incalculable-sundown-82514

    09/20/2018, 5:43 PM
    we get to play some tricks in JS that make it harder to make that mistake (you can pass the actual
    Role
    object in and we grab the ARN from it)
  • a

    aloof-tailor-93191

    09/20/2018, 5:43 PM
    now getting this:``` error: Plan apply failed: creating urn😛ulumi:billing-dev::billing::aws:lambda/function:Function:😒lacker: Error creating Lambda function: InvalidParameterValueException: Uploaded file must be a non-empty zip ```
  • a

    aloof-tailor-93191

    09/20/2018, 5:43 PM
    I tried
    asset.NewFileArchive("./function")
    and
    asset.NewFileArchive("./function.zip")
  • a

    aloof-tailor-93191

    09/20/2018, 5:44 PM
    $ tree function
    function
    └── function.py
    
    0 directories, 1 file
    $ unzip -l function.zip
    Archive:  function.zip
      Length      Date    Time    Name
    ---------  ---------- -----   ----
         2844  2018-09-20 08:56   function.py
    ---------                     -------
         2844                     1 file
  • i

    incalculable-sundown-82514

    09/20/2018, 5:44 PM
    hmm.
  • i

    incalculable-sundown-82514

    09/20/2018, 5:47 PM
    so the only thing the Go SDK has to do is pass a filename to the engine
  • i

    incalculable-sundown-82514

    09/20/2018, 5:47 PM
    maybe the Go program is running with a strange working directory?
  • a

    aloof-tailor-93191

    09/20/2018, 5:51 PM
    I think it's finding the file ok
  • a

    aloof-tailor-93191

    09/20/2018, 5:52 PM
    if I use an invalid path (like 'fun.zip'), it errors out:
    marshaling properties: awaiting input property endpoint: rpc error: code = Unknown desc = failed to compute archive hash: open ./fun.zip: no such file or directory
  • i

    incalculable-sundown-82514

    09/20/2018, 5:52 PM
    ah, I see
  • i

    incalculable-sundown-82514

    09/20/2018, 5:52 PM
    that’s strange
  • a

    aloof-tailor-93191

    09/20/2018, 6:26 PM
    I'm able to work around it for the time being by uploading the code to S3 and using that instead of local code
  • a

    aloof-tailor-93191

    09/20/2018, 6:56 PM
    awesome, I got estimated billing notification to slack working, all created with Pulumi (go)
    🎉 2
  • a

    aloof-tailor-93191

    09/20/2018, 6:56 PM
  • a

    aloof-tailor-93191

    09/20/2018, 6:56 PM
    all along the way, the error messages were very helpful
  • a

    aloof-tailor-93191

    09/20/2018, 6:56 PM
    I got quite a few as I learned the API
  • a

    aloof-tailor-93191

    09/20/2018, 6:57 PM
    and then supplied the wrong values and AWS rejected me with helpful messages too
  • a

    aloof-tailor-93191

    09/20/2018, 8:42 PM
    one thing I ran into was adding DependsOn to the lambda
  • i

    incalculable-sundown-82514

    09/20/2018, 8:43 PM
    awesome!
  • a

    aloof-tailor-93191

    09/20/2018, 8:43 PM
    lambdaFunction, err := lambda.NewFunction(ctx, "slacker", &lambda.FunctionArgs{
    		Runtime: "python3.6",
    		S3Bucket: "code-123123123",
    		S3Key:    "function.zip",
    		Timeout:  300,
    		Handler:  "function.lambda_handler",
    		Role:     lambdaRole.Arn(),
    	}, pulumi.ResourceOpt{
    		DependsOn: []pulumi.Resource{policyAttachment},
    	})
  • a

    aloof-tailor-93191

    09/20/2018, 8:43 PM
    that gives a compile err:
    ./main.go:107:32: cannot use policyAttachment (type *iam.RolePolicyAttachment) as type pulumi.Resource in array or slice literal:
            *iam.RolePolicyAttachment does not implement pulumi.Resource (wrong type for URN method)
                    have URN() *pulumi.URNOutput
                    want URN() pulumi.URN
  • a

    aloof-tailor-93191

    09/20/2018, 8:43 PM
    I'm guessing there's work to be done on matching up the types?
  • i

    incalculable-sundown-82514

    09/20/2018, 8:46 PM
    hmm, that’s unfortunate. that looks like a bug in tfgen (github.com/pulumi/pulumi-terraform)
  • i

    incalculable-sundown-82514

    09/20/2018, 8:46 PM
    can you open a bug on that?
  • a

    aloof-tailor-93191

    09/20/2018, 8:46 PM
    yes
  • i

    incalculable-sundown-82514

    09/20/2018, 8:47 PM
    iam.RolePolicyAttachment
    should definitely implement
    pulumi.Resource
Powered by Linen
Title
i

incalculable-sundown-82514

09/20/2018, 8:47 PM
iam.RolePolicyAttachment
should definitely implement
pulumi.Resource
View count: 3