green-musician-49057
05/18/2021, 3:47 PMpulumi.Secret
in golang? Do we have to use ApplyT to get convert the output to the right type?important-sandwich-62391
05/19/2021, 10:10 PMripe-shampoo-80285
05/24/2021, 12:52 AMbored-table-20691
05/24/2021, 8:29 PMint
/ IntOutput
value from a stack reference. Specifically, in one stack I did a ctx.Export("db-port", <http://pulumi.Int|pulumi.Int>(5432)
, and then in another stack I had a reference to it. Since there isn’t a GetIntOutput
option, I ended up having to do it manually with ApplyT
, and then found out that the value comes across as a float64
(I’m assuming due to the JSON encoding). I ended up with this utility function:
func getIntOutput(ref *pulumi.StackReference, key string) pulumi.IntOutput {
output := ref.GetOutput(pulumi.String(key))
return output.ApplyT(func(port interface{}) int {
return int(port.(float64))
}).(pulumi.IntOutput)
}
I wanted to see if this was expected and also if the above solution is reasonable.ambitious-salesmen-39356
05/25/2021, 4:31 PMmany-agent-57485
05/26/2021, 12:53 PMpulumi.StringOutput
to string
or pulumi.String
? thanks !ambitious-salesmen-39356
05/26/2021, 4:15 PMcrd2pulumi
to take the CRD and convert it to Go types, pretty fabulous. However, I'm not sure if this is a me problem or something crd2pulumi missed - one of the types where I'd expect it to have fields is an empty struct:
type TargetGroupBindingSpecServiceRefPortArgs struct {
}
I'd expect this to have like a Port: <http://pulumi.Int|pulumi.Int>
field. When I go to define a port:
_, err = tgb.NewTargetGroupBinding(ctx, serviceName, &tgb.TargetGroupBindingArgs{
ApiVersion: pulumi.String("elbv2.k8s.aws/v1beta1"),
Kind: pulumi.String("TargetGroupBinding"),
Metadata: &metav1.ObjectMetaArgs{
Name: pulumi.String(serviceName),
Namespace: namespace.Metadata.Elem().Name(),
},
Spec: &tgb.TargetGroupBindingSpecArgs{
TargetType: pulumi.String("ip"),
ServiceRef: &tgb.TargetGroupBindingSpecServiceRefArgs{
Name: svc.Metadata.Elem().Name().Elem().ToStringOutput(),
Port: &tgb.TargetGroupBindingSpecServiceRefPortArgs{
Port: <http://pulumi.Int|pulumi.Int>(80),
},
},
TargetGroupARN: pulumi.Sprintf("%s", tgArnOutput),
},
})
I get an unknown field Port in struct literal
bored-table-20691
05/26/2021, 5:51 PMbucket, err := s3.NewBucket(ctx, fmt.Sprintf("my-bucket-%s", region), nil)
if err != nil {
return err
}
ctx.Export("bucket", bucket.ID())
And then in another stack:
infraStack, err := pulumi.NewStackReference(ctx, "...", nil)
infraBucket := infraStack.GetStringOutput(pulumi.String("bucket"))
auditLogLocation := pulumi.Sprintf("<s3://%s/audit-logs>", infraBucket)
auditLogLocation
is now a secret (i.e. if I export it, it shows up as a secret), and I have to explicitly do pulumi.Unsecret(…).(pulumi.StringOutput)
on it.
This happens for any value that comes from the other stack. This is with Pulumi 3.3.0.modern-nest-74116
05/29/2021, 4:39 AMEc2LaunchTemplateInvalidConfiguration: User data was not in the MIME multipart format
I am following AWS provided examples https://docs.aws.amazon.com/batch/latest/userguide/launch-templates.html
Not sure what I am doing wrong. All suggestions are welcome.
launchTemplate, err := ec2.NewLaunchTemplate(ctx, resourceName, &ec2.LaunchTemplateArgs{
….
UserData: pulumi.StringPtr(base64.StdEncoding.EncodeToString([]byte(`
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="
--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash
set -ex
BOOTSTRAP_SH=/etc/eks/bootstrap.sh
BOOTSTRAP_USE_MAX_PODS_SEARCH="USE_MAX_PODS:-true"
KUBELET_CONFIG=/etc/kubernetes/kubelet/kubelet-config.json
# MAX_PODS=58
# search for the string to be replaced by sed and return a non-zero exit code if not found. This is used for safety in case the bootstrap.sh
# script gets changed in a way that is no longer compatible with our USE_MAX_PODS replacement command.
grep -q $BOOTSTRAP_USE_MAX_PODS_SEARCH $BOOTSTRAP_SH
# set the default for USE_MAX_PODS to false so that the maxPods value set in KUBELET_CONFIG will be honored
sed -i"" "s/$BOOTSTRAP_USE_MAX_PODS_SEARCH/USE_MAX_PODS:-false/" $BOOTSTRAP_SH
--==MYBOUNDARY==--
`))),
})
boundless-addition-81455
05/31/2021, 11:58 AMripe-shampoo-80285
06/04/2021, 2:58 AMwide-activity-54187
06/04/2021, 12:55 PMsticky-bear-14421
06/11/2021, 9:44 AMpeeringProvider, err := aws.NewProvider(ctx, fmt.Sprintf("peeringProvider-%s", peer.Name), &aws.ProviderArgs{
AssumeRole: &aws.ProviderAssumeRoleArgs{
RoleArn: pulumi.String(fmt.Sprintf("arn:aws:iam::%s:role/%s", peer.AccountID, peer.RouteTables["peeringAccepterRole"])),
SessionName: pulumi.String("peeringAccepterSession"),
},
Region: pulumi.String(region.Name),
}, pulumi.Provider(provider), pulumi.DependsOn([]pulumi.Resource{provider, role}),
)
if err != nil {
return err
}
Even with the pulumi.DependsOn() containing my role reference, this does not align this provider with the changes on the role.
Any hints on how to fix this ordering?red-football-97286
06/14/2021, 1:12 PMripe-shampoo-80285
06/14/2021, 5:20 PMsticky-bear-14421
06/15/2021, 11:54 AMmammoth-honey-6147
06/15/2021, 5:06 PMvar k3sNodeList []*ec2.Instance
in ctx.export
? It appears just iterating through the array elements in a loop and using ctx.export
only prints out the last in the array.sticky-bear-14421
06/21/2021, 2:08 PMfoo.bar..ApplyT()
to enforce Pulumi to wait for the creation of a particular resource?bright-sandwich-93783
06/26/2021, 4:57 PMbright-sandwich-93783
06/26/2021, 5:02 PMnumerous-thailand-80976
06/28/2021, 2:31 AMvpc, err := network.NewNetwork(ctx, projectID+"-vpc-"+config.Name, &network.NetworkArgs{
AutoCreateSubnetworks: pulumi.Bool(config.AutocreateSubnets),
Name: pulumi.String(config.Name),
RoutingConfig: &network.NetworkRoutingConfigArgs{
RoutingMode: ?
},
})
I’m having an issue with the ?, RoutingMode
is an object of *(network,NetworkRoutingConfigArgs).RoutingMode
type for which there are 2 constants `network.NetworkRoutingConfigRoutingModeGlobal`and network.NetworkRoutingConfigRoutingModeRegional
.
I’ve tried the following but all are rejected by the compiler:
&network.NetworkRoutingConfigRoutingModeGlobal
&network.NetworkRoutingConfigRoutingMode{ network.NetworkRoutingConfigRoutingModeGlobal }
&network.NetworkRoutingConfigRoutingMode(network.NetworkRoutingConfigRoutingModeGlobal)
Does anyone know how I can pass the constant to the RoutingMode
field?bright-sandwich-93783
06/29/2021, 7:33 PMApply
function doesn't return a raw string. how can I do this? Small go snippet would be awesome.bright-sandwich-93783
06/29/2021, 11:52 PMpulumi preview/up
fails? I would at least expect Pulumi to tell me which line of code or resource configuration is invalid. For example, I'm trying to create a resource but missing an AWS required field. the error message is
Diagnostics:
pulumi:pulumi:Stack (app-staging):
error: program failed: 1 error occurred:
* invalid value for required argument 'ThumbprintLists'
exit status 1
error: an unhandled error occurred: program exited with non-zero exit code: 1
bright-sandwich-93783
06/29/2021, 11:52 PMbright-sandwich-93783
06/29/2021, 11:56 PMbright-sandwich-93783
07/01/2021, 9:35 PMApplyT
callback, I need to make some network calls. This is because I need the raw string value of an Output
for use as a parameter to an API call somewhere. That API call might fail inside the ApplyT
callback, yet I don't see a way to propagate this error up, since ApplyT
only returns an Output
. Any advice here?bright-sandwich-93783
07/01/2021, 9:52 PMApplyTWithContext
, because docs say that The provided context can be used to reject the output as canceled.
, but there is no other mention of the word cancel or how to detect if an output has been "cancelled"salmon-account-74572
07/02/2021, 6:25 PMpulumi preview
I get this:
panic: sync: WaitGroup is reused before previous Wait has returned
goroutine 1 [running]:
sync.(*WaitGroup).Wait(0xc000386258)
/usr/local/go/src/sync/waitgroup.go:132 +0xae
<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*Context).wait|github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*Context).wait>(0xc000386140, 0x0, 0x0)
/Users/slowe/Code/Go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.4.0/go/pulumi/context.go:156 +0x50
<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.RunWithContext(0xc000386140|github.com/pulumi/pulumi/sdk/v3/go/pulumi.RunWithContext(0xc000386140>, 0x1c3a4c8, 0xc0000440ef, 0xc)
/Users/slowe/Code/Go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.4.0/go/pulumi/run.go:112 +0x2a6
<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.RunErr(0x1c3a4c8|github.com/pulumi/pulumi/sdk/v3/go/pulumi.RunErr(0x1c3a4c8>, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/slowe/Code/Go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.4.0/go/pulumi/run.go:84 +0x23f
<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.Run(0x1c3a4c8|github.com/pulumi/pulumi/sdk/v3/go/pulumi.Run(0x1c3a4c8>, 0x0, 0x0, 0x0)
/Users/slowe/Code/Go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.4.0/go/pulumi/run.go:41 +0x59
main.main()
/Users/slowe/Code/Repos/lab/infra/aws-infra-go/main.go:14 +0x3e
exit status 2
error: an unhandled error occurred: program exited with non-zero exit code: 1
If I comment out the NAT gateway code (which consumes the EIP), then the error goes away.
This worked in previous versions of the SDK. I can share my code upon request, in the event that I’m doing something incorrectly.alert-monitor-28534
07/06/2021, 8:09 AMvalues.yml
, this is what I have now:
"env": pulumi.Map{
"name": pulumi.String("DUCKDNS_TOKEN"),
"valueFrom": pulumi.Map{
"secretKeyRef": pulumi.Map{
"name": pulumi.String("duckdns"),
"key": pulumi.String("token"),
},
},
},
pulumi up
says this when deploying: warning: skipped value for env: Not a table.
How should I do this?bright-sandwich-93783
07/06/2021, 8:18 PMApplyTWithContext
mentions that the provided context can be used to reject the output as cancelled. If I call the context cancel
method, what am I supposed to expect? ApplyTWithContext
only returns a single value of type Output
. As a caller of ApplyTWithContext
how am I supposed to detect a "rejected output"?