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

    happy-gpu-24908

    11/15/2021, 5:34 PM
    Hi, I am trying out to get a docker image data to deploy the latest version to gcp cloud run.
    image, err := docker.NewRemoteImage(ctx, dockerImage, &docker.RemoteImageArgs{
    		Name:        pulumi.Sprintf("%s-docker.pkg.dev/%s/%s/%s:%s", repo.Location, repo.Project, repo.RepositoryId, conf.serviceName, conf.version),
    		KeepLocally: pulumi.Bool(true),
    		PullTriggers: pulumi.StringArray{
    			pulumi.String("something"),
    		},
    	})
    	if err != nil {
    		return err
    	}
    But this works randomly. Means half of the time it works, half of the time it returns error. Related to https://github.com/pulumi/actions/issues/28
  • q

    quiet-addition-42622

    11/16/2021, 2:18 AM
    Hello, does anyone have experience with table driven tests and pulumi? I’m having issues testing functions using the
    pulumi.RequireSecret()
    and
    pulumi.Unsecret()
    functions. The tests pass, but fail with the data race flag set because of
    <http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*OutputState).fulfillValue()|github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*OutputState).fulfillValue()>
    assigning values to the
    *pulumi.OutputState
    , even though each sub test has its own context and values. Here is the code I’m trying to test and the associated unit tests for it.
    m
    • 2
    • 5
  • n

    numerous-printer-41511

    11/19/2021, 4:33 PM
    Is there a way to get the default AWS provider? I’m realizing that I created a bunch of resources without an explicit provider. This is fine, but now that I’d like to create multiple stacks with AssumeRole’d providers, I need to pass them in. But if you change anything about the provider that a resource was created with, Pulumi treats it as a
    replace
    operation. So i need a handle on the default provider to pass it in for backward compatibility. Grr any ideas?
  • m

    mammoth-honey-6147

    11/25/2021, 9:12 PM
    Working with the Rancher2 Provider and attempting to deploy a chart from a repo, but encountering a panic - details in 🧵
    s
    • 2
    • 5
  • m

    mammoth-honey-6147

    11/30/2021, 1:27 PM
    What options are available to effectively "sleep/wait/pause the goroutine" during/after resource creation? I have some code that generates a
    certificate
    resource type, facilitated by cert-manager. I'm using
    dns-01
    challenge request, so although the
    certificate
    object type is created, it won't be
    ready
    for 60-90 seconds, this is causing issues with my application that reads the corresponding secret prematurely.
  • c

    cuddly-tailor-40542

    12/02/2021, 2:25 AM
    Hi all! I’m searching for a way to use the “ready” attribute mentioned in this thread in Golang. Anytime I reference the constant that got instantiated with the Helm chart, the
    Ready
    attribute does not show. The documentation unfortunately couldn’t help me
  • b

    busy-island-31180

    12/04/2021, 12:52 AM
    hi folks - I’m here because I’m really struggling to understand how to do something in Go for Pulumi. That concept is… if I have a resource that takes a 
    string
     as an input. How do I convert from 
    pulumi.InputString
     to a vanilla 
    string
     ? for a concrete example, I am creating a role: https://www.pulumi.com/registry/packages/aws/api-docs/iam/role/#assumerolepolicy_go this role needs an 
    AssumeRolePolicy
     (which is just a string/json document). In order to construct this json document, I need an output value from another resource (an OIDC provider), which would not be known until 
    apply
     time I simply don’t understand how to pass in a vanilla string, when that string needs to be async/dynamically created
    b
    • 2
    • 46
  • a

    ambitious-salesmen-39356

    12/12/2021, 5:40 PM
    Any recommendations on how to clean this up or do it in a less...icky? way?
    scp.go
  • a

    ambitious-salesmen-39356

    12/12/2021, 5:41 PM
    Particularly wondering the warnings I'm getting here. Not a problem persay as the program works as expected, but I'm wondering if they're indicative of me doing something gross but not gross enough to fail compile =D
  • l

    little-notebook-32921

    12/12/2021, 9:10 PM
    @ambitious-salesmen-39356 it's just barking at you over redundant type declatration, it's automatically assuming any of the underlying elements are already a map[string]interface{} from the top level declaration. Since an interface{} is in all reality an ambiguous type it won't complain about the "Version" field either.
    ✅ 1
  • a

    ambitious-salesmen-39356

    12/12/2021, 9:21 PM
    so, exports and such make sense to me - but what is the preferred pattern for references another resource within the same program? Is the expectation that everything within a program is created within a single function, so that if I need a VPC ID for creating a subnet, I can just reference the *Vpc object?
  • a

    ambitious-salesmen-39356

    12/12/2021, 9:22 PM
    I ask because I started down the path of splitting different concerns within the same program up into separate functions, ie
    func createVPC(ctx *pulumi.Context) err {}
  • a

    ambitious-salesmen-39356

    12/12/2021, 9:24 PM
    but I then realised then I'd lose the ability to reference a resource created in a different function - so would I then want to return the *Vpc object and accept it as a parameter like
    func createSubnets(ctx *pulumi.Context, vpc *ec2.Vpc) err {}
    ? Am I attempting something stupid here?
    b
    • 2
    • 1
  • l

    lively-dentist-84054

    12/12/2021, 11:51 PM
    hi! I'm trying to get access to the ID of the
    NodeSecurityGroup
    created by
    eks.NewCluster
    but the type returned is a
    *SecurityGroupOutput
    and I can't figure out how to get the ID output out of it to use with other resources
    b
    • 2
    • 10
  • n

    nice-engineer-43278

    12/13/2021, 4:00 PM
    Hi guys!! I have a question!! Is it normal that a preview for a new stack take to long to finish? (like 10 minutes and still counting...)
    q
    • 2
    • 2
  • n

    nice-engineer-43278

    12/13/2021, 4:01 PM
    is just showing the fist line of create stack...
  • n

    nice-engineer-43278

    12/13/2021, 4:02 PM
    Previewing update (draftea/dev)
    
    View Live: <https://app.pulumi.com/draftea/mongo/dev/previews/f6e0caff-8747-457b-b337-9e8cb430cac9>
    
         Type                 Name       Plan       
     +   pulumi:pulumi:Stack  mongo-dev  create
  • h

    hundreds-article-77945

    12/17/2021, 8:26 PM
    How do you serialize a
    pulumi.StringPtrOutput
    with
    pulumi.Sprintf
    ? I’m getting this:
    "serviceAccount:<...>.svc.id.goog[%!s(*string=0x140001425d0)/%!s(*string=0x140006169b0)]"
    from:
    pulumi.Sprintf("serviceAccount:%s.svc.id.goog[%v/%v]", config.Require(ctx, "gcp:project"), namespace.Metadata.Name(), ksa.Metadata.Name()),
    The first arg is a string, but the latter two are string pointers.
    • 1
    • 4
  • r

    ripe-shampoo-80285

    01/04/2022, 2:39 AM
    Anybody knows how to create a ConfigMap from a config.yaml file using Golang Pulumi?
    b
    • 2
    • 8
  • c

    clean-church-26730

    01/04/2022, 6:10 PM
    How does one pass values to the v3 helm library? (I'm having trouble with the syntax for pulumi.mapoutput)
    b
    • 2
    • 2
  • i

    important-sandwich-62391

    01/05/2022, 12:44 AM
    Any ideas on how to work around this bug https://github.com/pulumi/pulumi/issues/7890 ? Downgrade pulumi version for the whole team? Or can we do something in our code to work around it
  • m

    melodic-policeman-1516

    01/07/2022, 5:50 PM
    Hi! Somewhat related to: https://pulumi-community.slack.com/archives/CCWP5TJ5U/p1619092305112300?thread_ts=1619083701.112200&amp;cid=CCWP5TJ5U Is there a prescribed way to unmarshal json to a pulumi type (e.g.
    pulumi.String
    , or
    pulumi.Bool
    )?
    b
    • 2
    • 1
  • n

    nice-engineer-43278

    01/10/2022, 3:43 PM
    Hi guys I have a doubt that I spect you can clarify… I’m trying to generate a queue with dead letter configuration with the Go SDK but when I try to pass the ARN of the dead queue it fails because appear as empty, even if the queue is marked as it depends from the dead queue.
    l
    • 2
    • 3
  • n

    nice-engineer-43278

    01/10/2022, 3:43 PM
    this is the code that I’ve ran
  • n

    nice-engineer-43278

    01/10/2022, 3:43 PM
    package main
    
    import (
    	"encoding/json"
    	"fmt"
    	"os"
    
    	"<http://github.com/pulumi/pulumi-aws/sdk/v4/go/aws/sqs|github.com/pulumi/pulumi-aws/sdk/v4/go/aws/sqs>"
    	"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
    )
    
    var (
    	stage string
    
    	queueNamePlayerFreezePrice string
    )
    
    func init() {
    	queueNamePlayerFreezePrice = "PlayerFreezePrice"
    
    	stage = os.Getenv("STAGE")
    
    	if stage == "" {
    		stage = "dev"
    	}
    }
    
    func main() {
    	name := queueNamePlayerFreezePrice
    
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// -----------------------------------------------------//
    		// ---------------- DEAD LEATER QUEUE ------------------//
    		// -----------------------------------------------------//
    
    		deadQueuePfpName := fmt.Sprintf("%s-Dead-%s", name, stage)
    
    		deadQueuePfp, err := sqs.NewQueue(ctx, deadQueuePfpName, &sqs.QueueArgs{
    			DelaySeconds:           <http://pulumi.Int|pulumi.Int>(0),
    			ReceiveWaitTimeSeconds: <http://pulumi.Int|pulumi.Int>(5),
    			Tags: pulumi.StringMap{
    				"stage": pulumi.String(stage),
    			},
    		})
    		if err != nil {
    			return err
    		}
    
    		ctx.Export(fmt.Sprintf("DeadQueue%s-id", name), deadQueuePfp.ID())
    		ctx.Export(fmt.Sprintf("DeadQueue%s-arn", name), deadQueuePfp.Arn)
    
    		// -----------------------------------------------------//
    		// ----------------- MAIN EVENT QUEUE ------------------//
    		// -----------------------------------------------------//
    
    		redrivePolicyPfp, err := json.Marshal(map[string]interface{}{
    			"deadLetterTargetArn": deadQueuePfp.Arn,
    			"maxReceiveCount":     4,
    		})
    		if err != nil {
    			return err
    		}
    
    		queueNamePfp := fmt.Sprintf("%s-%s", name, stage)
    
    		queuePfp, err := sqs.NewQueue(ctx, queueNamePfp, &sqs.QueueArgs{
    			DelaySeconds:           <http://pulumi.Int|pulumi.Int>(0),
    			ReceiveWaitTimeSeconds: <http://pulumi.Int|pulumi.Int>(5),
    			RedrivePolicy:          pulumi.String(string(redrivePolicyPfp)),
    			Tags: pulumi.StringMap{
    				"stage": pulumi.String(stage),
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			deadQueuePfp,
    		}))
    		if err != nil {
    			return err
    		}
    
    		ctx.Export(fmt.Sprintf("Queue%s-arn", name), queuePfp.ID())
    		ctx.Export(fmt.Sprintf("Queue%s-arn", name), queuePfp.Arn)
    
    		return nil
    	})
    }
  • n

    nice-engineer-43278

    01/10/2022, 3:45 PM
    this is the error:
    aws:sqs:Queue (PlayerFreezePrice-dev):
        error: 1 error occurred:
            * error creating SQS Queue (PlayerFreezePrice-dev-64a7583): InvalidParameterValue: Value {"deadLetterTargetArn":{},"maxReceiveCount":4} for parameter RedrivePolicy is invalid. Reason: Invalid value for deadLetterTargetArn.
            status code: 400, request id: e655efc4-e352-5db1-86b9-b592b5f812df
  • b

    bored-table-20691

    01/12/2022, 9:34 PM
    If I have one stack exporting a
    []string
    , in the importing stack it will be a StringArrayOutput. Two questions: 1. What’s the right way to import this, given the
    stackRef.GetOutput(...)
    returns an
    AnyOutput
    ? What’s the best way to make it a
    StringArrayOutput
    ? 2. Is there any way to iterate over the values in there as
    StringOutput
    ? e.g. say I want to make a new
    StringArrayOutput
    that is the result of running
    pulumi.Sprintf
    on the individual items in the array, can I do that? I really hope I don’t have to do this in an
    ApplyT
    , because it’s going to be very painful.
    b
    • 2
    • 4
  • f

    fierce-ability-58936

    01/14/2022, 3:01 AM
    Just having a go with Go and trying to figure it out. When creating a CustomComponent, I want to provide a list of strings to it as an input. Constructed this from some examples:
    type RepositoryArgs struct {
      Environments pulumi.StringArrayInput `pulumi:"environments"`
    }
    How do I iterate over
    pulumi.StringArrayInput
    ? Like so?
    args.Environments.ToStringArrayOutput().ApplyT(func(environments []string) error { 
    ...
    }
    Should it be this or just
    []string
    ? What's the meaning of
    pulumi:"environments"
    here? Also, what's the meaning of this snippet? https://github.com/pulumi/examples/blob/master/aws-go-s3-folder-component/s3folder.go#L82-L90 Sorry. docs on this are really lean and there's not much in the examples either.
    b
    • 2
    • 1
  • c

    chilly-plastic-75584

    01/14/2022, 7:54 PM
    Am I supposed to be able to load a Values.yml for running a chart without migrating that into code? I have an adhoc chart I need for staging only and figured I'd run through pulumi. Not sure if i can provide it the Values.yaml and it transform it on demand though.
    b
    • 2
    • 1
  • r

    ripe-shampoo-80285

    01/14/2022, 11:33 PM
    Bucket ObjectOwnership control doesn't support BucketOwnerEnforced (see my initial question in #aws channel as well) https://pulumi-community.slack.com/archives/CRH5ENVDX/p1642199766091800 https://github.com/pulumi/pulumi/issues/8763
Powered by Linen
Title
r

ripe-shampoo-80285

01/14/2022, 11:33 PM
Bucket ObjectOwnership control doesn't support BucketOwnerEnforced (see my initial question in #aws channel as well) https://pulumi-community.slack.com/archives/CRH5ENVDX/p1642199766091800 https://github.com/pulumi/pulumi/issues/8763
View count: 3