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
  • b

    boundless-telephone-98269

    02/13/2022, 8:24 PM
    thanks, I'll take a look!
  • l

    limited-rainbow-51650

    02/14/2022, 9:07 AM
    I want to create a custom component provider, starting from the Go template here https://github.com/pulumi/pulumi-component-provider-go-boilerplate I cloned this repo and ran
    make install_nodejs_sdk
    on my Mac, but even without a single change, this build command fails:
    $ make install_nodejs_sdk
    rm -rf sdk/nodejs
    cd provider/cmd/pulumi-gen-xyz && go run . nodejs ../../../sdk/nodejs /Users/r.de.smet/Projects/pulumi-component-provider-go-boilerplate/schema.yaml
    cd sdk/nodejs/ && \
                    yarn install && \
                    yarn run tsc --version && \
                    yarn run tsc && \
                    cp ../../README.md ../../LICENSE package.json yarn.lock ./bin/ && \
                    sed -i.bak -e "s/\${VERSION}/0.0.1/g" ./bin/package.json && \
                    rm ./bin/package.json.bak
    yarn install v1.22.17
    warning package.json: No license field
    info No lockfile found.
    warning @pulumi/xyz@${VERSION}: No license field
    [1/4] 🔍  Resolving packages...
    warning @pulumi/aws > read-package-tree@5.3.1: The functionality that this package provided is now in @npmcli/arborist
    warning @pulumi/aws > @pulumi/pulumi > read-package-tree@5.3.1: The functionality that this package provided is now in @npmcli/arborist
    warning @pulumi/aws > aws-sdk > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
    warning @pulumi/aws > aws-sdk > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
    warning @pulumi/aws > aws-sdk > uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See <https://v8.dev/blog/math-random> for details.
    [2/4] đźšš  Fetching packages...
    [3/4] đź”—  Linking dependencies...
    [4/4] 🔨  Building fresh packages...
    success Saved lockfile.
    ✨  Done in 28.81s.
    yarn run v1.22.17
    warning package.json: No license field
    $ /Users/r.de.smet/Projects/pulumi-component-provider-go-boilerplate/sdk/nodejs/node_modules/.bin/tsc --version
    Version 3.9.10
    ✨  Done in 0.35s.
    yarn run v1.22.17
    warning package.json: No license field
    $ /Users/r.de.smet/Projects/pulumi-component-provider-go-boilerplate/sdk/nodejs/node_modules/.bin/tsc
    ✨  Done in 12.38s.
    yarn unlink xyz
    yarn unlink v1.22.17
    error No registered package found called "xyz".
    info Visit <https://yarnpkg.com/en/docs/cli/unlink> for documentation about this command.
    make: *** [install_nodejs_sdk] Error 1
    $
    What am I missing here? Also, if I want to change the setup to have my own package name, generated in my own namespace (npm), what files should I update manually and which ones are generated? Not much documented about all of this.
    q
    • 2
    • 13
  • q

    quiet-laptop-13439

    02/14/2022, 3:01 PM
    Hi, is there a standard way to convert
    StringPtrOutput
    to
    StringOutput
    (and default to zero value?) Right now we wrote our own helper func, but it looks strange
  • b

    boundless-telephone-98269

    02/14/2022, 3:53 PM
    StringPtrOutput
    has a
    Elem()
    method that does this ^
    🙏 3
    c
    • 2
    • 1
  • l

    late-energy-66663

    02/14/2022, 8:27 PM
    Hi, I am deploying virtual machine using go automation api . While testing and deploying machine there was panic and rerunning the program I am Now getting following error when I try to either delete stack or create new machine
    error: could not create stack: the stack is currently locked by 1 lock(s). Either wait for the other process(es) to end or manually delete the lock file(s).
    the only Way I found was to go and delete the .json lock file manually from the stack folder . Just wondering how I can manage and check if the stack is lock using Automation api and unlock the locked stack using automation api , instead of the deleting the stack file manually .
  • l

    little-soccer-5693

    02/14/2022, 10:27 PM
    i just updated my ws with a
    go mod tidy
    but now i'm getting:
    pulumi:providers:aws (default):
    `error: no resource plugin 'aws-v4.37.4' found in the workspace or on your $PATH, install the plugin using `pulumi plugin install resource aws v4.37.4`` but that doesn't work:
    $ pulumi plugin install resource aws v4.37.4
    [resource plugin aws-4.37.4] installing
    error: [resource plugin aws-4.37.4] downloading from : 403 HTTP error fetching plugin from <https://get.pulumi.com/releases/plugins/pulumi-resource-aws-v4.37.4-linux-amd64.tar.gz>
    any idea what's going on?
    m
    • 2
    • 1
  • q

    quiet-addition-42622

    02/15/2022, 2:53 AM
    Hello - when I call
    pulumi.All(a, b, c).ApplyT(myFunc)
    and
    c
    is a pulumi secret, the resulting output of
    ApplyT
    is also a secret, right? This doc talks about
    ApplyT()
    but not
    All()
    b
    • 2
    • 2
  • t

    thousands-telephone-86052

    02/22/2022, 4:56 PM
    Hello folks, hoping to get some guidance from people here that have experience using the pulumi golang sdk and preferably also with the typescript sdk. After having used the typescript sdk for aws and eks for some time - it has been quite a seamless experience, and things work "as advertised" for the most part. I have also made some small contributions which were graciously accepted into the upstream code. Now I am trying to use the golang sdk (mainly so that we can get wider adoption in house), and the experience seems quite degraded compared to ts. Also, it seems like the golang libs still rely on typescript-written plugins (e.g. aws, kubernetes) and so its not as compelling to use golang. Additionally, (eks) stacks created with golang seem to be more "high level" - as in - they are not aware of lower-level resources in the stack. This could be partially due my being relatively new to Golang itself. Any well-informed opinions on this? Are developers finding the Golang sdk to be mature and usable/maintainable enough to justify using it over TS for prod infra? Thanks in advance.
  • b

    bored-table-20691

    02/22/2022, 8:24 PM
    I don't have experience with the TS one, but we use Go extensively and find it mature. There are Go specific pain points, mostly around Go’s restrictive type system. I think for someone coming from TS specifically it can be painful. I'm not sure what you mean about plug-ins written in TS in reference to above, or access to the lower level resources.
  • t

    thousands-telephone-86052

    02/22/2022, 10:31 PM
    Hi @bored-table-20691 thanks for the response! Here is what I mean. This is a "pure" Go stack, starting with no pulumi plugins installed. When I
    up
    the stack, it downloads the plugins it needs.. which.. are in typescript, not Go / native:
    âžś  eks_go git:(feature/eks_go_aws) âś— pulumi plugin ls
    NAME  KIND  VERSION  SIZE  INSTALLED  LAST USED
    
    TOTAL plugin cache size: 0 B
    âžś  eks_go git:(feature/eks_go_aws) âś— ls ~/.pulumi/plugins/
    âžś  eks_go git:(feature/eks_go_aws) âś—
    âžś  eks_go git:(feature/eks_go_aws) âś— ls
    eksCluster.go  go.mod  go.sum  main.go  nodeGroups.go  Pulumi.eks-test.yaml  Pulumi.yaml
    âžś  eks_go git:(feature/eks_go_aws) âś— pulumi up
    Please choose a stack, or create a new one: eks-test
    Previewing update (eks-test):
    [resource plugin kubernetes-3.16.0] installing
    Downloading plugin: 0 B / 30.27 MiB [----------------------------------]   0.00%[resource plugin eks-0.37.1] installing
    Downloading plugin: 656.37 KiB / 656.37 KiB [=======================] 100.00% 0s
    [resource plugin aws-4.37.4] installing
    Downloading plugin: 30.27 MiB / 30.27 MiB [=========================] 100.00% 1s
    Downloading plugin: 96.60 MiB / 96.60 MiB [=========================] 100.00% 2s
         Type                     Name              Plan       Info
     +   pulumi:pulumi:Stack      eks_go-eks-test   create     3 errors; 9 messages
     +   └─ pulumi:providers:aws  test_east1  create
    
    Diagnostics:
      pulumi:pulumi:Stack (eks_go-eks-test):
        error: Error: invocation of pulumi:pulumi:getResource returned an error: unknown resource urn:pulumi:eks-test::eks_go::aws:iam/role:Role::eksEc2Role
            at Object.callback (/home/vikas/.pulumi/plugins/resource-eks-v0.37.1/node_modules/@pulumi/runtime/resource.ts:139:40)
            at Object.onReceiveStatus (/home/vikas/.pulumi/plugins/resource-eks-v0.37.1/node_modules/@grpc/grpc-js/src/client.ts:338:26)
            at Object.onReceiveStatus (/home/vikas/.pulumi/plugins/resource-eks-v0.37.1/node_modules/@grpc/grpc-js/src/client-interceptors.ts:426:34)
            at Object.onReceiveStatus (/home/vikas/.pulumi/plugins/resource-eks-v0.37.1/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48)
            at /home/vikas/.pulumi/plugins/resource-eks-v0.37.1/node_modules/@grpc/grpc-js/src/call-stream.ts:276:24
            at processTicksAndRejections (node:internal/process/task_queues:78:11)
  • b

    bored-table-20691

    02/22/2022, 10:32 PM
    I don’t think my Go projects match what you’re seeing.
  • b

    bored-table-20691

    02/22/2022, 10:33 PM
    What does your
    Pulumi.yaml
    in that directory look like?
  • b

    bored-table-20691

    02/22/2022, 10:33 PM
    (also we shoudl thread responses, apologies)
    👍 1
    t
    • 2
    • 52
  • l

    late-energy-66663

    02/25/2022, 10:26 PM
    Hi Team , I am deploying EC2 machine using golang api. After provisioning we would like to confirm if the machine is fully provisioned before deploying other services. Is there a way to check using pulumi automation api to confirm that machine is fully provisioned?
    b
    a
    q
    • 4
    • 11
  • g

    green-musician-49057

    02/28/2022, 7:30 PM
    What's the conventional way to bubble up errors from within an
    ApplyT
    ? I noticed that the function can return an error...but it doesn't seem to have any effect. Are we supposed to call
    panic(err)
    within the interpolation function? And if so, is there a risk of that
    panic
    causing issues with the pulumi state or the infra state?
    g
    • 2
    • 3
  • c

    chilly-plastic-75584

    03/04/2022, 7:07 PM
    Any article on how to make sure you don't get nil pointer errors with pulumi and Go, like a static check or something that can help flag when I forget to make sure something was a pointer?
  • c

    calm-train-38333

    03/05/2022, 3:06 PM
    Team, trying to setup some
    wafv2
    objects on AWS. This `pulumiTypes.go` file is unusually big at 70MB and 7 million lines. My local
    go build
    on Mac takes 60 secs. Pulumi preview mostly hangs, sometimes works. All Github Action containers crash because of their provisioned CPU/mem. It is just
    wafv2
    that is giving problems. Provisioning other objects are mostly fine both locally and on CD pipelines. Any reason on why this is such an outlier and ways to work around this?
    e
    • 2
    • 3
  • q

    quiet-laptop-13439

    03/09/2022, 2:50 PM
    is there a way of accessing component children from the test? We're trying to register all of them via MockMonitor, but don't seem to find a way to access it later
    • 1
    • 1
  • p

    proud-machine-85126

    03/09/2022, 7:05 PM
    Is there a way to add arbitrary HTTP headers to a provider? Context: I'm using the openstack provider and need to go through a proxy that requires additional auth via extra headers.
    l
    • 2
    • 2
  • a

    alert-crayon-18838

    03/10/2022, 4:09 AM
    Hi guys, can someone point out what I'm missing here? I'm trying to import a VpcId from a VPC object into a subnet declaration with the AWS provider.
    vpc, err := ec2.NewVpc(ctx, "partseeker-dev", &ec2.VpcArgs{
    			CidrBlock: pulumi.String("10.0.0.0/16"),
    		})
    		assertNoErr(err)
    
    		publicA, err := ec2.NewSubnet(ctx, "publicA", &ec2.SubnetArgs{
    			VpcId:            pulumi.String(vpc.ID()),    //<---- here
    			AvailabilityZone: pulumi.String(appAZ),
    			CidrBlock:        pulumi.String("10.0.10.0/24"),
    		})
    VpcId needs a string, and I thought vpc.ID() returns a string... but it returns the type IDOutput. What should I be doing instead?
    b
    • 2
    • 9
  • a

    alert-crayon-18838

    03/11/2022, 2:00 AM
    Is there a better way to write json iam policies than using a bunch of []map[string]interface{}{ everywhere and pull it together with json.Marshal?
    b
    i
    b
    • 4
    • 20
  • b

    bright-needle-80161

    03/14/2022, 5:31 PM
    Hello Community !! Posting the same question I asked on #kubernetes https://pulumi-community.slack.com/archives/CRFURDVQB/p1647278981882749
  • r

    red-football-97286

    03/15/2022, 2:01 PM
    How are people structuring there pulumi Go project folders? What directories do you use? Go recommends folders like CMD, Internal.
    c
    • 2
    • 4
  • f

    flaky-school-70251

    03/17/2022, 7:59 AM
    Hi all. I'm using the Go SDK to create a small util to set up a stack using a local backend. For example:
    project := auto.Project(workspace.Project{                                                                                                                                                                
            Name:    tokens.PackageName(projectName),                                                                                                                                                         
            Runtime: workspace.NewProjectRuntimeInfo("go", nil),                                                                                                                                              
            Backend: &workspace.ProjectBackend{                                                                                                                                                               
                    URL: "file://~/.pulumi-local",                                                                                                                                                               
            },                                                                                                                                                                                                })                                                                                                                                                                                                        
                                                                                                         
    s, err := auto.UpsertStackInlineSource(ctx, stackName, projectName, deployFunc(configPath), project, secretsProvider, stackSettings, envvars)
    My issue is that if
    ~/.pulumi-local
    directory doesn't exist, this will fail with
    stderr: error: unable to open bucket file:///home/tim/.pulumi-local: stat /home/tim/.pulumi-local: no such file or directory
    . If the directory exists, the code works and the stack is updated without issue. Looking through the pulumi CLI code, the 'login' function is what would normally create the local backend directory if it doesn't exist, but I can't seem to find this functionality exposed by the SDK.
  • l

    late-energy-66663

    03/20/2022, 10:30 PM
    Hi I am deploying EKS cluster using pulumi . I see there are different Go SDK I can use to deploy cluster .
    <http://github.com/pulumi/pulumi-aws/sdk/v4/go/aws/eks|github.com/pulumi/pulumi-aws/sdk/v4/go/aws/eks>
    or
    "<http://github.com/pulumi/pulumi-eks/sdk/go/eks|github.com/pulumi/pulumi-eks/sdk/go/eks>"
    Just wondering which SDK should i use for EKS cluster provisioning ?
    q
    • 2
    • 3
  • p

    polite-napkin-90098

    04/08/2022, 7:31 PM
    Perhaps I need to ask the question in here: I'm trying to get the Instance Role from a newly created EKS cluster (i.e. created in the same block of code. But I'm struggling to dereference the Output from the cluster object to give me the name of the Instance Role so I can add some permissions to it. https://pulumi-community.slack.com/archives/C84L4E3N1/p1649445617086939?thread_ts=1649258358.357719&amp;cid=C84L4E3N1 Describes where I've got to. I'd be very grateful for any insight as to how I can resolve this.
  • q

    quaint-hair-91883

    04/12/2022, 10:15 AM
    Hi. Can someone give me an example of how to use https://www.pulumi.com/registry/packages/eks/api-docs/managednodegroup/#nodegrouptaint ?
    • 1
    • 3
  • m

    modern-nest-74116

    04/14/2022, 6:44 PM
    Hi, how can I serialize multiple iam.NewUser creation with iam.NewGroupMembership? The following code works most of the time but I’d like to implement a better serialization between these two resources:
    func createUsers(ctx *pulumi.Context,
    	group mcfg.Group,
    	globalTags map[string]string) ([]pulumi.StringOutput, error) {
    
    	// the order of users in the list is important to avoid
    	// unnecessary updates of GroupMembership and to serialize its update
    	// with NewUsers exectued in a loop.
    	sort.Strings(group.Users)
    
    	var newUsersNames []pulumi.StringOutput
    	var newUser *iam.User
    	var err error
    	for _, user := range group.Users {
    
    		newUser, err = iam.NewUser(ctx, user, &iam.UserArgs{
    			Name: pulumi.String(user),
    			Path: pulumi.String("/perf/"),
    			Tags: pulumi.ToStringMap(globalTags),
    		})
    		if err != nil {
    			return nil, err
    		}
    
    		newUsersNames = append(newUsersNames, newUser.Name)
    	}
    
    	if len(newUsersNames) > 0 {
    
    		ngMemberName := fmt.Sprintf("%s-%s", group.Name, "mozart")
    
    		// a hack to serialize NewUsers with NewGroupMembership
    		_, err := iam.NewGroupMembership(ctx, ngMemberName, &iam.GroupMembershipArgs{
    			Users: pulumi.ToStringArray(group.Users),
    			Group: pulumi.String(group.Name),
    		}, pulumi.DependsOn([]pulumi.Resource{newUser}))
    
    		if err != nil {
    			return nil, err
    		}
    	}
    
    	return newUsersNames, nil
    }
    My initial attempt was to convert
    newUsersNames - []pulumi.StringOutput
    to
    []string
    using ApplyT on each of the list elements. It works but then the creation of
    NewUsers
    and
    NewGroupMembership
    is not serialized. In the above version I just pass the list of users which is provided by a function argument to
    GroupMembershipArgs
    and try to create a dependency on the last
    NewUser
    resource created in the loop. Is there a better way of doing this?
  • l

    late-energy-66663

    04/15/2022, 3:44 PM
    Hi I am using the Automation to create the aws EKS cluster.The pulumi code is expose as the rest interface . if we send the single request to create cluster it works fine . However when we send multiple requests to create multiple clusters on the same stack , it produces an error saying that stack is locked and cannot proceed further until the one task is complete . Is there a way where we can send multiple request in Parallel. We are using go code for performing this task
    e
    • 2
    • 3
  • s

    salmon-account-74572

    04/19/2022, 3:16 PM
    I found an unexpected behavior yesterday while porting some Pulumi code over to a set of new AWS accounts. As part of porting the code over to the new accounts, I switched from using
    AWS_PROFILE
    in the environment (set via
    .envrc
    and
    direnv
    ) to specifying the AWS profile in a Pulumi configuration value (i.e.,
    pulumi config set aws:profile <name>
    ). This worked for everything except a Pulumi program that sets up VPC peering between VPCs in two different regions. The error it returned was related to the AWS provider that operates in the “destination” region (one provider operates in the “source” region to set up peering-related objects, and a second provider operates in the “destination” region to set up the corresponding objects on the other side of the connection). Is this expected behavior? I haven’t dug deep into fixing it yet, but I’m guessing there’s something about the way I’m setting up the destination provider that isn’t working with/respecting the
    aws:profile
    configuration value. (All this is written in Go, hence why I’m posting here.)
    b
    • 2
    • 2
Powered by Linen
Title
s

salmon-account-74572

04/19/2022, 3:16 PM
I found an unexpected behavior yesterday while porting some Pulumi code over to a set of new AWS accounts. As part of porting the code over to the new accounts, I switched from using
AWS_PROFILE
in the environment (set via
.envrc
and
direnv
) to specifying the AWS profile in a Pulumi configuration value (i.e.,
pulumi config set aws:profile <name>
). This worked for everything except a Pulumi program that sets up VPC peering between VPCs in two different regions. The error it returned was related to the AWS provider that operates in the “destination” region (one provider operates in the “source” region to set up peering-related objects, and a second provider operates in the “destination” region to set up the corresponding objects on the other side of the connection). Is this expected behavior? I haven’t dug deep into fixing it yet, but I’m guessing there’s something about the way I’m setting up the destination provider that isn’t working with/respecting the
aws:profile
configuration value. (All this is written in Go, hence why I’m posting here.)
b

billowy-army-68599

04/19/2022, 4:07 PM
@salmon-account-74572 we recently removed the
aws:profile
config variable because it was causing more trouble for shared stacks than value: https://github.com/pulumi/pulumi-aws/pull/1909 long story short, you'll need to use the env var now
s

salmon-account-74572

04/19/2022, 4:48 PM
Hmm…that’s a shame, because allowing the profile to be stored as part of the stack makes it easy for me to “port” a stack among/between multiple AWS accounts with different profiles. However, given that we are working with full-featured programming languages here, I can see a path forward (based on the comment in the PR) to pull from either the config value or the environment variable.
View count: 6