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

    bland-florist-27487

    07/26/2022, 8:36 AM
    <http://github.com/pulumi/pulumi-awsx/sdk|github.com/pulumi/pulumi-awsx/sdk>
    still shows
    v1.0.0-testplsignore.0
    as
    latest
    on pkg.go.dev (and via go get) Any new releases on the way? 😅
    f
    p
    • 3
    • 4
  • c

    cold-orange-37453

    07/27/2022, 11:00 AM
    How can I convert a pulumi.StringOutput to string ? I am provisioning an AWS codebuild, when trying to create a policy document some of the fields are for example
    Resources
    require a slice of string ([]string) , I wan to pass some values here that I am creating in the pulumi code as well. Is there any way to do this ? I can just put the string value there since resource arn format is pre determined, but is there any better way ?
    b
    f
    • 3
    • 10
  • p

    prehistoric-sandwich-7272

    07/27/2022, 1:19 PM
    Anyone has experience with Helm release? trying to pass values to an helm chart like so:
    Values: pulumi.Map{
      "controller": pulumi.Map{
        "resources": pulumi.MapArray{pulumi.Map{
          "limits": pulumi.MapArray{pulumi.Map{
            "cpu":    pulumi.String(values.Controller.Limits.CPU),
            "memory": pulumi.String(values.Controller.Limits.Memory),
          }},
          "requests": pulumi.MapArray{pulumi.Map{
            "cpu":    pulumi.String(values.Controller.Requests.CPU),
            "memory": pulumi.String(values.Controller.Requests.CPU),
          }},
        }},
        "replicas": <http://pulumi.Int|pulumi.Int>(values.ReplicaCount),
      },
    },
    and getting the error:
    2022/07/27 16:14:41 warning: cannot overwrite table with non table for karpenter.controller.resources (map[limits:map[cpu:1 memory:1Gi] requests:map[cpu:1 memory:1Gi]])
    • 1
    • 1
  • l

    lively-table-10226

    07/29/2022, 1:11 PM
    Hi, I am trying to convert pulumi.StringOutput to string. Can anyone help?
    m
    • 2
    • 1
  • h

    happy-football-3560

    07/29/2022, 7:51 PM
    Hi, I'm trying to input a s3 path into a Databricks cluster initscript but am having trouble with the nested syntax to provide it. https://www.pulumi.com/registry/packages/databricks/api-docs/cluster/#clusterinitscripts3 One odd bit that I see is the link from InitScripts to the ClusterInitScriptArgs lists []ClusterInitScriptArgs as the type but the link takes me to an entry named ClusterInitScript. Does this mean that I need to be doing
    ClusterInitScript: { S3: {
    ? (also I'm very new to Pulumi - I feel like I might be missing something obvious)
    _, err := databricks.NewCluster(ctx, "my-cluster", &databricks.ClusterArgs{
      InitScripts: []databricks.ClusterInitScriptArgs{
        {
          S3: &databricks.ClusterInitScriptS3{
            Destination: "<s3://path/to/script.sh>",
          },
        },
      },
    }
    b
    • 2
    • 4
  • h

    happy-football-3560

    08/01/2022, 8:12 PM
    Hey - I'm having trouble finding information on how to conditionally include a setting. I want to read an input variable and only include the configuration if the input variable exists. It's the one I got help on before but I want to only include it conditionally.
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
            conf := config.New(ctx, "")
            INIT_SCRIPT := config.Get("init_script_path")
    
    		cluster, err := databricks.NewCluster(ctx, "example", &databricks.ClusterArgs{
    			// logic here to only include if INIT_SCRIPT has content //
                InitScripts: databricks.ClusterInitScriptArray{
    				databricks.ClusterInitScriptArgs{
    					S3: databricks.ClusterInitScriptS3Args{
    						Destination: pulumi.String("something"),
    					},
    				},
    			},
                // END INCLUDE AREA //
    		})
    
    		if err != nil {
    			return fmt.Errorf("error creating cluster: %w", err)
    		}
    
    		ctx.Export("clusterName", cluster.ClusterName)
    
    		return nil
    
    	})
    }
    g
    • 2
    • 2
  • p

    prehistoric-sandwich-7272

    08/03/2022, 1:59 PM
    Hey guys, any idea why I get the following panic error:
    panic: applier must have 1 input parameter assignable from []acm.CertificateDomainValidationOption
    the code is:
    route53Record, errRoute53 := route53.NewRecord(ctx, fmt.Sprintf("%s-%s-acm-dns-record-validation", values.Name, values.DomainName), &route53.RecordArgs{
    Name: appCert.DomainValidationOptions.ApplyT(func(name acm.CertificateDomainValidationOptionOutput) pulumi.StringPtrOutput {
       return name.ResourceRecordName()
    }).(pulumi.StringOutput),
    }
    • 1
    • 1
  • p

    prehistoric-sandwich-7272

    08/03/2022, 5:40 PM
    Any idea how can I use the getIngress function? not sure what to pass to it and how. tried doing the following:
    ingress, errGetIngress := networkingv1.GetIngress(ctx, values.Name, pulumi.IDInput(grafana.Status.Namespace()), &state)
    but I get the syntax error:
    Cannot convert an expression of the type 'pulumi.StringPtrOutput' to the type 'pulumi.IDInput'
    f
    • 2
    • 1
  • f

    fancy-library-39649

    08/03/2022, 10:05 PM
    How do I upgrade the provider version for resources created with an older version for the AWS SDK plugin? When I run
    pulumi plugin install resource aws 5.10.0
    and do a
    pulumi up
    , Pulumi will download v5.4.0 of the plugin because of some existing resources that were created with that old version, even though the old version was uninstalled from the system. How do I get Pulumi to upgrade the resources to start using 5.10.0?
    f
    b
    • 3
    • 3
  • s

    sparse-intern-71089

    08/04/2022, 7:14 AM
    This message was deleted.
  • c

    cold-orange-37453

    08/04/2022, 10:00 AM
    Do we have an equivalent of json.Marshal for pulumi Types like pulumi.Map , pulumi.MapArray etc. ?
    • 1
    • 1
  • c

    cold-orange-37453

    08/05/2022, 11:50 AM
    Is there a way I can tell if the current context is a destroy command in pulumi ? Similar to ctx.DryRun() for preview ?
  • b

    brainy-furniture-43093

    08/05/2022, 6:07 PM
    Hi All, I have been trying to deploy my lambda on the new provided.al2 runtime for Go. I package my code using
    GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -tags lambda.norpc -o build/bootstrap
    And then I zip it using Pulumi's
    NewAssetArchive
    Code: pulumi.NewAssetArchive(map[string]interface{}{
    			"bootstrap": pulumi.NewFileAsset("../onboarding/cmd/onboarding/build/bootstrap"),
    			"Makefile":  pulumi.NewFileAsset("../onboarding/cmd/onboarding/build/Makefile"),
    		}),
    And my Makefile contains
    build-Onboarding:
    	cp ./bootstrap $(ARTIFACTS_DIR)/.
    But for some reason it's like my Makefile doesn't execute then the bootstrap file stays in some root folder. Any ideas here? Thank you
    • 1
    • 1
  • l

    lively-table-10226

    08/08/2022, 10:08 AM
    Hi! I have created dual region bucket with location as
    US-EAST1+US-WEST1
    , and i tried to reapply the code once again. Ideally it should not do anything. But it says location changed from
    US
    to
    US-EAST1+US-WEST1
    and trying to delete the bucket and recreate it. Can someone help me to resolve this.
  • m

    mammoth-country-64756

    08/10/2022, 10:52 AM
    Hi beautiful people, I’m having some issues ignoring changes, I have the current scenario: In the screenshot you can see that the installation of a helm chart shows changes, I’d like to ignore these, what do I do? I tried:
    pulumi.IgnoreChanges([]string{"kube-system/aws-load-balancer-tls"}),
    and
    pulumi.IgnoreChanges([]string{"kubernetes:core/v1:Secret"})
    Full code:
    _, err = helm.NewChart(ctx, "load-balancer-controller", helm.ChartArgs{
    		Chart:     pulumi.String("aws-load-balancer-controller"),
    		Version:   pulumi.String("1.4.3"),
    		Namespace: pulumi.String(lbcNamespace),
    		FetchArgs: helm.FetchArgs{
    			Repo: pulumi.String("<https://aws.github.io/eks-charts>"),
    		},
    		Values: pulumi.Map{
    			"clusterName": eksCluster.Name,
    			"serviceAccount": pulumi.Map{
    				"create": pulumi.BoolPtr(false),
    				"name":   lbcServiceAccount.Metadata.Name(),
    			},
    		},
    	}, pulumi.Provider(k8sProvider),
    		pulumi.IgnoreChanges([]string{"kubernetes:core/v1:Secret"}),
    	)
    None worked. Any help welcome 🙇
    w
    n
    • 3
    • 7
  • b

    bored-spoon-83710

    08/11/2022, 3:22 PM
    Hello, I need to put a sleep between the creation of two resources to accommodate eventual consistency issues (like here https://github.com/pulumi/pulumi-eks/blob/00ae8e77a63f0bca99f188c003e7cdb89d5aebeb/nodejs/eks/cluster.ts#L335 for example), but I don’t know how to do this properly in Go. I tried the same approach as in the link (time.Sleep in an ApplyT), but it seems to sleep also during preview, which is annoying. Therefore, I looked for an equivalent of this Terraform resource https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep and found https://github.com/pulumiverse/pulumi-time, but it doesn’t seem fully functional at the time. How can I proceed?
  • h

    happy-football-3560

    08/11/2022, 3:49 PM
    Hello. I'm trying to run a remote command on an EC2 instance but am having trouble with the authentication. I have a .pem file I can use to ssh in but am unsure how exactly to set that in the remote command.
    AWS_INSTANCE_KEY := conf.RequireSecret("aws_key")
    ...
    		updatePythonCmd, err := remote.NewCommand(ctx, "updatePythonCmd", &remote.CommandArgs{
    			Connection: &remote.ConnectionArgs{
    				Host:       instance.PrivateIp,
    				Port:       pulumi.Float64(22),
    				User:       pulumi.String("ubuntu"),
    				PrivateKey: AWS_INSTANCE_KEY,
    			},
    			Create: pulumi.String("(sudo apt -y update || true);" +
    				"(sudo apt-get -y upgrade);" +
    				"(sudo apt install -y python3-pip)\n"),
    		})
    I tried setting the key in two ways 1. by just passing the key in - though I kept running into issues reading the multiple lines from the command line 2. with
    pulumi config set --path --secret aws_key
    /path/to/key
    The error I get is
    error: ssh: no key found
    The instance is created just before this remote command and I do have the correct key because I can ssh to the instance using it. I'm think I'm missing something with how to read the key into the remote command or? Really appreciate any tips.
    • 1
    • 1
  • e

    elegant-zoo-39359

    08/12/2022, 2:28 PM
    Hi, is there a way of creating a nil
    IntPtrOutput
    ? I've configured a helper function to take an
    IntPtrInput
    and then want to use
    ApplyT
    on this value to conditionally output a data structure if it is not nil, but the
    ApplyT
    fails with a NPE if it is nil. e.g. the following will fail if
    size
    is a
    IntPtrInput
    that is nil (at
    ToIntPtrOutput()
    ). I could check for nil, but I don't think that would not work if
    size
    is an
    IntPtrOutput
    (because only its applied value would be nil).
    res := size.ToIntPtrOutput().ApplyT(
    		func(size *int) *ec2.LaunchTemplateBlockDeviceMapping {
    Is there a nice way to generically handle this? I can use
    pulumi.All
    but that does not seem quite as elegant:
    res := pulumi.All(size).ApplyT(
    		func(args []interface{}) []ec2.LaunchTemplateBlockDeviceMapping {
    			if args[0] != nil {
    				size := args[0].(*int)
  • c

    chilly-jordan-84053

    08/14/2022, 5:11 PM
    Hi, any good resources on how to debug pulumi Go with Goland. I'm able to start the debugger and watch some values. But for example if I want to debug my vnet values, that I pass to my storage function. All I see is different type... but the value I can never watch what's in! In my vnet I created a subnet that I want to use for my storage. How can I see in goland debugger my subnet values during debbuging ? All I see is my var like: vhub.Subnets.OutputState with many other props but nothing usefull...
    e
    • 2
    • 5
  • f

    flaky-arm-38472

    08/17/2022, 3:21 AM
    Is doable to use a generic type (T ) on a resource args field?. for example, when creating a Route:
    _, err = ec2.NewRoute(ctx, "my-route", &ec2.RouteArgs{
    		RouteTableId:         routeTable.ID(),
    		DestinationCidrBlock: pulumi.String("0.0.0.0/0"),
    		GatewayId:            pulumi.String("igw-xxxf0axxx"), 
    	})
    On the GatewayId field, to have the type T or accept a generic type?. I am trying to don't repeat a lot of the same definitions to create routes. Some of my routes require TransitGatewayId or NatGatewayId instead. Do I have to create every single route repeating all the code and changing that field one by one?
    m
    • 2
    • 2
  • a

    alert-autumn-36186

    08/17/2022, 3:30 AM
    Hey guys,Is there an easy way to continue to override values.yaml with infra.yaml in pulumi?
    helm install "$infra" --values inf.yaml
    Can only use the "value" function?
    package main
    
    import (
    	"<http://github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/helm/v3|github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/helm/v3>"
    	"<http://github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/yaml|github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/yaml>"
    	"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
    )
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
             _, err = helm.NewChart(ctx, "sql-data", helm.ChartArgs{
                Chart:       pulumi.String("sql-data"),
                APIVersions: nil,
                // The optional namespace to install chart resources into.
                Namespace: pulumi.String("eshop"),
    
                // Overrides for chart values.
                Values: pulumi.Map{
                     ".Values.inf.sql.host": pulumi.String("sql-data-eshop"),
                },
    }
    b
    • 2
    • 4
  • m

    most-mouse-38002

    08/19/2022, 1:53 PM
    Not really a Go guy, so I don’t know if it is Go or Pulumi giving me issues, but I find the Output stuff really confusing. Ideally how are we supposed to use these values? Wrap the entire stack inside an
    ApplyT()
    function for every time we need a value?
    b
    • 2
    • 8
  • b

    bitter-kite-21926

    08/21/2022, 12:50 PM
    What’s the right way to create VPC for later use in eks.NewCLuster?
    ✅ 1
    • 1
    • 2
  • m

    most-mouse-38002

    08/22/2022, 1:42 PM
    I have to admit the Go base of a stack gets super dirty and error prone once you start mixing existing resources with resources created by the stack. Is there any best practices here, since the data types for these different scenarios generally are incompatible with each other is feels more like hacking at this point than structurally typed infrastructure.
    b
    • 2
    • 5
  • f

    fancy-spoon-7206

    08/23/2022, 8:32 PM
    Has anyone tried packing all the pulumi code in a binary and using that binary somewhere else? Are there any best practices around this?
    b
    • 2
    • 1
  • f

    fancy-spoon-7206

    08/24/2022, 1:23 PM
    Prior to using the automation API, I was using the config package (https://www.pulumi.com/docs/intro/concepts/config/) in Go to ingest config. And then a
    pulumi up
    would do the trick. I did not add any code to set the config. Now with the automation API all I see in the examples is
    // set stack configuration specifying the AWS region to deploy
    	s.SetConfig(ctx, "aws:region", auto.ConfigValue{Value: "us-west-2"})
    Is there a way to consume config using a
    Pulumi.dev.yaml
    file? instead of setting one config at a time. Pulumi.dev.yaml
    config:
      aws:region: us-east-2
      aws:profile: sandbox
      aep:config:
        bucket:
          name: dinesh-test
    l
    p
    • 3
    • 4
  • c

    clean-window-19746

    08/24/2022, 8:31 PM
    Hi, I’m new to Pulumi (not very adept in go either), and am trying to use a Provider output from
    pulumi-eks
    to create a resource in the newly created cluster. Given it’s an output type, I figured I’d need to use an
    apply
    (can’t pass it in directly as a pulumi ResourceOption), and though there have been many examples here in Slack and online, I am still having trouble using it. I have given an attempt, and know I am doing it wrong, but can’t seem to progress forward. if anyone has any suggestions, that would be much appreciated. Thanks in advance!
    k8sProvider := eksCluster.Provider.ApplyT(
    			func(cluster kubernetes.Provider) kubernetes.Provider {
    				return cluster
    			}).(pulumi.ProviderResource)
    b
    f
    • 3
    • 8
  • c

    creamy-advantage-17182

    08/28/2022, 4:34 PM
    Hi, we have our own cloud provider and we also have our library so we can create resources via it like you would do in aws (news3) for instance. But we would like to integrate this lib with pulumi so we can use pulumi instead of the library. I've looked at the docs and found that dynamic providers can only be created by implementing an interface in ts, js and python. So is there a way to integrate pulumi with this library?
    b
    • 2
    • 1
  • s

    stocky-sundown-45608

    08/29/2022, 8:34 AM
    I am provisioning EKS with Pulumi, to setup the platform I am also bringing up VPC using Pulumi and Go SDKs. VPC Provisioning along with subnets works as expected, however making any changes to the stack, for example changing the subnet settings (dns enabled), ends up trying to create a new subnet and fails. Coming from terraform, shouldn’t changes to provisioned resources be supported?
    b
    • 2
    • 6
  • p

    prehistoric-sandwich-7272

    08/29/2022, 3:19 PM
    Hi all! I am trying to create a folder inside an S3 bucket. The name of the bucket is taken from a stack reference, and I need to concatenate its name with the new folder name So I did applyT on the stack reference and passed the concatenated variable - the issue is that I still get a pointer value and not the string value:
    bucketName = stackReference.GetStringOutput(pulumi.String("BucketName"))
    appliedBucket := bucketName.ApplyT(func(name string) string {
    	return name
    }).(pulumi.StringInput)
    
    resourceName := fmt.Sprintf("%v/%s/", appliedBucket, "testFolder")
    key := fmt.Sprintf("testFolder")
    
    // Create S3 folder
    bucket, err := s3.NewBucketObjectv2(ctx, resourceName, &s3.BucketObjectv2Args{
    	Key:    pulumi.String(key),
    	Bucket: appliedBucket,
    	Tags:   tags,
    })
    So when I do pulumi up I get this:
    Type                      Name                                      Plan       Info
         pulumi:pulumi:Stack       audio-player-sdk-staging                             1 message
     +   └─ aws:s3:BucketObjectv2  {0xc000782d90}/testFodler/
    b
    • 2
    • 12
Powered by Linen
Title
p

prehistoric-sandwich-7272

08/29/2022, 3:19 PM
Hi all! I am trying to create a folder inside an S3 bucket. The name of the bucket is taken from a stack reference, and I need to concatenate its name with the new folder name So I did applyT on the stack reference and passed the concatenated variable - the issue is that I still get a pointer value and not the string value:
bucketName = stackReference.GetStringOutput(pulumi.String("BucketName"))
appliedBucket := bucketName.ApplyT(func(name string) string {
	return name
}).(pulumi.StringInput)

resourceName := fmt.Sprintf("%v/%s/", appliedBucket, "testFolder")
key := fmt.Sprintf("testFolder")

// Create S3 folder
bucket, err := s3.NewBucketObjectv2(ctx, resourceName, &s3.BucketObjectv2Args{
	Key:    pulumi.String(key),
	Bucket: appliedBucket,
	Tags:   tags,
})
So when I do pulumi up I get this:
Type                      Name                                      Plan       Info
     pulumi:pulumi:Stack       audio-player-sdk-staging                             1 message
 +   └─ aws:s3:BucketObjectv2  {0xc000782d90}/testFodler/
b

billowy-army-68599

08/29/2022, 3:22 PM
@prehistoric-sandwich-7272 if you’re going to do it this way, you need to create the bucketObject inside the apply
but I think you want this to be on the key, not the bucket name
p

prehistoric-sandwich-7272

08/29/2022, 3:39 PM
@billowy-army-68599 Something like this?
//Create folder
folder := bucketname.ApplyT(func(appliedBucket string) *s3Pkg.BucketObjectv2 {
   folder, err := s3Pkg.NewBucketObjectv2(ctx, resourceName, &s3Pkg.BucketObjectv2Args{
      Key:    pulumi.String(key),
      Bucket: pulumi.String(appliedBucket),
   })
   if err != nil {
      log.Fatalf("Got error while trying to create new S3 bucket! Error: %s", err)
   }
   return folder
})

log.Println(folder)
b

billowy-army-68599

08/29/2022, 3:39 PM
yes
p

prehistoric-sandwich-7272

08/29/2022, 3:50 PM
@billowy-army-68599 Does it make sense that I get no resource created when I put it inside the applyT? because when I run it I get nothing 😞
b

billowy-army-68599

08/29/2022, 3:58 PM
it won’t show up in preview, but again - i don’t think this is the correct solution
p

prehistoric-sandwich-7272

08/29/2022, 5:22 PM
@billowy-army-68599 what solution do you recommend?
I think the bucket must come from a stack reference in order for this function to work with any bucket so the bucket will always be a stringOutput which I will need to apply, no?
b

billowy-army-68599

08/29/2022, 5:34 PM
if it’s a stringOutput, you should be able to pass the name directly.
bucketName = stackReference.GetStringOutput(pulumi.String("BucketName"))

bucket, err := s3.NewBucketObjectv2(ctx, resourceName, &s3.BucketObjectv2Args{
	Key:    bucketName,
	Bucket: key/appliedBucket,
	Tags:   tags,
})
p

prehistoric-sandwich-7272

08/29/2022, 5:51 PM
@billowy-army-68599 still doesn’t work 😞 tried like this:
bucket := stackReference.GetStringOutput(pulumi.String("ProgrammaticSdkBucketName"))
appliedBucket := bucket.ApplyT(func(name string) string {
  return name
}).(pulumi.StringOutput)

folderName := "myFolder"
_, err := s3.NewBucketObjectv2(ctx, folderName+"/"+ctx.Stack(), &s3.BucketObjectv2Args{
  Key:    bucket,
  Bucket: pulumi.String(fmt.Sprintf("%s/%v", folderName, appliedBucket)),
})
and I get:
error: program failed: waiting for RPCs: marshaling properties: awaiting input property key: failed to convert <nil> to string
    exit status 1

    Provided name to get stack reference from: matanchetz//staging

    error: an unhandled error occurred: program exited with non-zero exit code: 1
ok I did manage to get it working that way, had a mixture with the parameter values thanks a lot!
🎉 1
View count: 12