green-musician-49057
04/19/2022, 5:30 PMquaint-hair-91883
04/21/2022, 1:45 PMstring
value out of pulumi.StringOutput
or pulumi,StringPtrOutput
?quaint-hair-91883
04/21/2022, 1:48 PMParams
struct that I use to set the values for a function and I need to get the output into the structquaint-hair-91883
04/21/2022, 1:50 PMastonishing-gpu-28317
04/22/2022, 2:11 PMastonishing-gpu-28317
04/22/2022, 2:12 PMbrave-lizard-56518
04/24/2022, 3:49 PMnsr, _ := pulumi.NewStackReference(ctx, vpcStackRef, nil)
eip1 := nsr.GetStringOutput(pulumi.String("eip-1"))
Now what I can’t figure out is how to read “data-subnets” into a slice. Can anybody help?
"resources": [
{
"urn": "urn:pulumi:dev::vpc::pulumi:pulumi:Stack::dev",
"custom": false,
"type": "pulumi:pulumi:Stack",
"outputs": {
"data-subnets": [
"subnet-abcddaed530b25d91",
"subnet-abcdcfacd0c04fe74",
"subnet-abcd693e4a8ae4ca8"
],
"eip-1": "eipalloc-abcdcfa5cf063576d"
bulky-agent-73210
04/26/2022, 1:22 PMpulumi up
, and the output changes. So I assume I’m using the wrong approach here.nice-airline-86891
04/28/2022, 4:51 AMsalmon-account-74572
05/02/2022, 10:07 PMpulumi preview
against one of my stacks (I’ll post the full error output in the thread). This is with Pulumi 3.29.1 on macOS running Go 1.18.1. The fix ended up being upgrading <http://golang.org/x/sys|golang.org/x/sys>
(via go get -u <http://golang.org/x/sys|golang.org/x/sys>
), and then pulumi preview
seemed to work just fine. Posting here in case someone else runs into a similar problem.clean-truck-93285
05/03/2022, 6:58 PMbusy-island-31180
05/09/2022, 11:50 PM*string
to a pulumi.StringPtrInput
?bored-spoon-83710
05/11/2022, 2:55 PMgo get <http://github.com/pulumi/pulumi-awsx/sdk|github.com/pulumi/pulumi-awsx/sdk>
it brings me a strange v1.0.0-testplsignore.0
version, and when I try a pulumi up
, I get the following error
Diagnostics:
pulumi:providers:awsx (default):
error: no resource plugin 'pulumi-resource-awsx' found in the workspace at version v1.0.0-testplsignore.0 or on your $PATH, install the plugin using `pulumi plugin install resource awsx v1.0.0-testplsignore.0`
This makes me think Go support isn’t ready yet. However, the relase notes talk about Go SDK: https://github.com/pulumi/pulumi-awsx/releases.
What’s the current situation?fancy-library-39649
05/11/2022, 5:43 PM*string
but all I can provide is a pulumi.StringOutput
from resource B.
How do I force the resolution of the StringOutput before A is initialized?
I do not want to init A inside the Apply
functions of B's outputs, because that gives me inaccurate previews.glamorous-holiday-25694
05/11/2022, 7:01 PMGo
and AWS
.
Having a weird issue when trying to update a stack containing EKS
. No matter what changes I add (a new node group or simply adding a Helm chart) an EKS cluster replace
is always included in the changes.
Is there something obvious Im missing?
Thank you!bored-spoon-83710
05/12/2022, 3:26 PMcluster, err := eks.NewCluster(ctx, "test",
&eks.ClusterArgs{
ProviderCredentialOpts: &eks.KubeconfigOptionsArgs{
RoleArn: pulumi.String("<arn>"),
},
CreateOidcProvider: pulumi.Bool(true),
SkipDefaultNodeGroup: pulumi.Bool(true),
},
)
if err != nil {
return fmt.Errorf("failed to create EKS cluster: %w", err)
}
_, err = eks.NewManagedNodeGroup(ctx, "ng1",
&eks.ManagedNodeGroupArgs{
Cluster: cluster.Core,
},
)
if err != nil {
return fmt.Errorf("failed to create EKS managed node group: %w", err)
}
and here is the error
Previewing update (test):
Type Name Plan Info
pulumi:pulumi:Stack pulumi-test-test 1 error; 2 messages
Diagnostics:
pulumi:pulumi:Stack (pulumi-test-test):
error: program failed: waiting for RPCs: marshaling properties: awaiting input property cluster: expected a ec2.SecurityGroup, got a resource of type ec2.SecurityGroup
exit status 1
error: an unhandled error occurred: program exited with non-zero exit code: 1
Do you know what this error means? Should I post this message in #aws instead?bored-spoon-83710
05/13/2022, 2:30 PMpulumi.Provider(cluster.Provider)
as a resource option on a NewNamespace()
call as its type is kubernetes.ProviderOutput
which doesn’t seem to be compatible with pulumi.ProviderResource
. Any idea?steep-translator-9040
05/17/2022, 7:54 AMpulumi-project-name
), I then provide RequireObject the key of the object I want to load from configuration (in my example stack
), and it should deserialise it accordingly.
import (
"<http://github.com/pulumi/pulumi/pkg/v3/testing/integration|github.com/pulumi/pulumi/pkg/v3/testing/integration>"
"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
"os"
"testing"
)
type Configuration struct {
Project string
Region
Ephemeral bool
}
type Region struct {
LongName string
ShortName string
}
// Pulumi.test.yaml
// encryptionsalt: ...........
// config:
// gcp:project: my-gcp-project-name
// pulumi-project-name:stack:
// project: my-gcp-project-name
// region:
// long: us-east1-b
// short: US
// ephemeral: false
// results in error:
// panic: missing required configuration variable 'pulumi-project-name:stack'; run `pulumi config` to set
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
var configuration Configuration
cfg := config.New(ctx, "")
cfg.RequireObject("stack", &configuration)
})
}
func TestExamples(t *testing.T) {
cwd, _ := os.Getwd()
integration.ProgramTest(t, &integration.ProgramTestOptions{
Quick: true,
SkipRefresh: true,
Dir: cwd,
Config: map[string]string{
"gcp:project": "my-gcp-project-name",
"pulumi-project-name:stack.project": "my-gcp-project-name",
"pulumi-project-name:stack.region.short": "US",
"pulumi-project-name:stack.region.long": "us-east1-b",
"pulumi-project-name:stack.ephemeral": "true",
},
})
}
busy-honey-73811
05/18/2022, 12:39 PMaws-native
) resources in Golang?
I have a real hard time to figure out how to do this (see all the ???
in below example). The main problem is that aws-native
uses no common (shared) types for tags and sets of tags, instead it uses generated interface
types specific to each taggable resource.
package aws
import (
"fmt"
"reflect"
"strings"
"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
)
type Tagger struct {
tags map[string]string
}
func NewTagger() *Tagger {
return &Tagger{}
}
func (*Tagger) isTaggable(ctx *pulumi.Context, typeName string, t reflect.Type) bool {
if strings.HasPrefix(typeName, "aws-native:") {
if field, found := t.FieldByName("Tags"); found {
switch field.Type.Kind() {
case reflect.Slice:
return true
}
}
}
return false
}
func (t *Tagger) Apply(ctx *pulumi.Context) error {
return ctx.RegisterStackTransformation(
func(args *pulumi.ResourceTransformationArgs) *pulumi.ResourceTransformationResult {
if t.isTaggable(ctx, args.Type, args.Props.ElementType()) {
ptr := reflect.ValueOf(args.Props)
val := ptr.Elem()
tags := val.FieldByName("Tags")
var tagList ???
if !tags.IsZero() {
tagList = tags.Interface().(???)
} else {
tagList = ???{}
}
for k, v := range t.tags {
tagList = append(tagList, ???{ Key: pulumi.String(k), Value: pulumi.String(v)})
}
tags.Set(reflect.ValueOf(tagList))
return &pulumi.ResourceTransformationResult{
Props: args.Props,
Opts: args.Opts,
}
}
ctx.Log.Warn(fmt.Sprintf("isTaggable(%s) -> false", args.Type), nil)
return nil
},
)
}
gray-sunset-39305
05/20/2022, 7:10 PMmain.go
file if helpful:
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Build the container image
image, err := docker.NewImage(ctx, "trustified-api", &docker.ImageArgs{
Build: &docker.DockerBuildArgs{
Context: pulumi.String("../"),
Dockerfile: pulumi.String("dev.Dockerfile"),
},
ImageName: pulumi.String("trustified-api:dev"),
SkipPush: pulumi.Bool(true),
})
if err != nil {
fmt.Printf("Error building image: %s", err.Error())
}
ctx.Export("baseImageName", image.BaseImageName)
ctx.Export("fullImageName", image.ImageName)
return nil
})
}
gray-sunset-39305
05/20/2022, 11:18 PMnetwork, err := docker.NewNetwork(ctx, "trustified", &docker.NetworkArgs{
Attachable: pulumi.Bool(true),
Name: pulumi.String("trustified-" + stack),
})
And now trying to launch a container in that network, but I’m not certain what to put in the “NetworksAdvanced” field. It seems like my network var should be the right thing but it errors because networks doesn’t implement ContainerNetworksAdvancedArrayInput.
Here’s the code I’m using:
apiContainer, err := docker.NewContainer(ctx, "api", &docker.ContainerArgs{
Envs: pulumi.ToStringArray(apiEnvVars),
Healthcheck: nil,
Image: api.ImageName,
Name: pulumi.String("api"),
NetworksAdvanced: network,
Ports: nil,
Volumes: nil,
})
How do I transform the network I created to a ContainerNetworksAdvancedArrayInput type?billions-wolf-76466
05/21/2022, 5:26 PMpulumi up
or pulumi preview
alert-dream-49584
05/26/2022, 5:36 PMflat-laptop-90489
06/01/2022, 7:40 PMbroad-parrot-2692
06/05/2022, 12:59 AMmost-airline-68480
06/06/2022, 9:24 PMpulumi.StringOutput
to string
)?broad-parrot-2692
06/11/2022, 5:02 AMgoogle-beta
provider? The syntax in the documentation seems off from what I actually need.
EDIT: The documentation here helped me get the correct syntax down. https://www.pulumi.com/docs/intro/concepts/resources/providers/ Anyone know where I can report this documentation discrepancy?mammoth-planet-78700
06/14/2022, 9:18 PMpulumi.Map{}
for tags, but with native each resource has its own typejolly-church-88521
06/16/2022, 3:10 PM""
as a CidrBlock. Not sure why. This is my code:
routeTable, err := ec2.NewRouteTable(ctx, n.genUniqName("route-private", i), &ec2.RouteTableArgs{
VpcId: n.VPC.ID(),
Routes: ec2.RouteTableRouteArray{
&ec2.RouteTableRouteArgs{
CidrBlock: subnet.CidrBlock
and subnet.CidrBlock
is from []*ec2.Subnet
. When I’m doing fmt.Println()
on it, I see {0xc0003c93b0}
.cold-orange-37453
06/17/2022, 5:58 AMInputDiff is true if this is a difference between old and new inputs rather than old state and new inputs.
, am I correct to understand that whenever there is some external change made to a resource, for example a tag is changed for AWS sqs, the InputDiff for that change will be False, whereas if I change the tag for AWS SQS in pulumi code, then InputDiff will be True ? I am writing pulumi code in golang.
Currently for both of these cases I am seeing InputDiff as Falsecold-orange-37453
06/17/2022, 5:58 AMInputDiff is true if this is a difference between old and new inputs rather than old state and new inputs.
, am I correct to understand that whenever there is some external change made to a resource, for example a tag is changed for AWS sqs, the InputDiff for that change will be False, whereas if I change the tag for AWS SQS in pulumi code, then InputDiff will be True ? I am writing pulumi code in golang.
Currently for both of these cases I am seeing InputDiff as False