• f

    fancy-spoon-7206

    3 months ago
    Is there a way to convert
    pulumi.StringOutput
    to
    string
    ? Its becoming weirdly difficult for me to get the tags right with all the custom types that don't seem to have a straight forward way to convert to string. The below does not work as
    natgw
    is a string and
    publicSubnets[0].AvailabilityZone
    is a StringOutput
    natGatewayName := "natgw" + publicSubnets[0].AvailabilityZone
    f
    b
    5 replies
    Copy to Clipboard
  • f

    fancy-spoon-7206

    3 months ago
    I am getting the below error with awsx using golang:
    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`
    I try installing the said plugin and the URL seems to be busted
    ➜ vpcx pulumi plugin install resource awsx v1.0.0-testplsignore.0 
    [resource plugin awsx-1.0.0-testplsignore.0] installing
    error: [resource plugin awsx-1.0.0-testplsignore.0] downloading from : 403 HTTP error fetching plugin from <https://get.pulumi.com/releases/plugins/pulumi-resource-awsx-v1.0.0-testplsignore.0-darwin-amd64.tar.gz>
    f
    b
    3 replies
    Copy to Clipboard
  • f

    fancy-spoon-7206

    3 months ago
    Has anyone tried using awsx successfully using golang?
  • f

    fancy-spoon-7206

    3 months ago
    Also, Is
    v1.0.0-testplsignore.0
    is a valid version?
  • m

    magnificent-helicopter-3467

    3 months ago
    Hi folks, cross-posting this here
    m
    1 replies
    Copy to Clipboard
  • f

    fancy-spoon-7206

    3 months ago
    Is there a way to tags resources more aptly when using awsx? I have the below starter code, but I only see a way to set tags at the VPC level and not for the other components that the vpcx module creates.
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cidr := "192.168.0.0/16"
    		vpcName := "dna"
    		_, err := ec2x.NewVpc(ctx, vpcName, &ec2x.VpcArgs{
    			CidrBlock: &cidr,
    			Tags:      pulumi.ToStringMap(namedTags(ctx, vpcName)),
    		})
    		if err != nil {
    			log.Fatalln(err)
    		}
    		return nil
    	})
    }
    This code does what is needed but the names are like
    <vpc-name>-private-1
    for a subnet for example.
    f
    b
    9 replies
    Copy to Clipboard
  • m

    magnificent-helicopter-3467

    3 months ago
    Hello all, I’m trying to create a service account (GCP) and attach an IAM policy to it. Considering the following snippet:
    sa, err := serviceaccount.NewAccount(ctx, s.Name, &serviceaccount.AccountArgs{
    			AccountId:   pulumi.String(s.Id),
    			DisplayName: pulumi.String("A service account for my app"),
    		})
    		if err != nil {
    			return err
    		}
    
    		fmt.Println("Service account email: ", sa.Email)
    		storageAdmin, err := organizations.LookupIAMPolicy(ctx, &organizations.LookupIAMPolicyArgs{
    			Bindings: []organizations.GetIAMPolicyBinding{
    				organizations.GetIAMPolicyBinding{
    					Role: "roles/compute.storageAdmin",
    					Members: []string{
    						sa.Email,
    					},
    				},
    			},
    		}, nil)
    2 questions here: • Can I rely on using
    sa.Email
    after calling
    serviceaccount.NewAccount
    ? Or does that run asynchronously and populate
    sa
    with promise-like values? • If I can use
    sa.Email
    where I have it, how do I convert this
    pulumi.StringOutput
    to
    String
    ?
  • b

    billowy-army-68599

    3 months ago
    Can I rely on using sa.Email after calling serviceaccount.NewAccount? Or does that run asynchronously and populate sa with promise-like values?
    Yes, passing an output from one resource as an input to another resource creates a dependency between them implicitly
    If I can use sa.Email where I have it, how do I convert this pulumi.StringOutput to String?
    You cannot convert a
    pulumi.StringOutput
    to a
    String
    - you need to resolve the value using
    ApplyT
    and then use the string. See https://leebriggs.co.uk/blog/2021/05/09/pulumi-apply for more information
  • f

    fancy-spoon-7206

    3 months ago
    I am getting the below error after adding a simple integration test from the docs:
    func TestVpc(t *testing.T) {
    	awsRegion := "us-east-1"
    	cwd, _ := os.Getwd()
    
    	integration.ProgramTest(t, &integration.ProgramTestOptions{
    		Quick:       true,
    		SkipRefresh: true,
    		Dir:         path.Join(cwd, "..", "..", "aep-base-infra"),
    		Config: map[string]string{
    			"aws:region": awsRegion,
    		},
    	})
    }
    Error:
    ➜ resources (main) ✗ go test ./...
    panic: proto: duplicate enum registered: pulumirpc.EnforcementLevel
    
    goroutine 1 [running]:
    <http://github.com/golang/protobuf/proto.RegisterEnum({0x101cb7b88|github.com/golang/protobuf/proto.RegisterEnum({0x101cb7b88>, 0x1a}, 0x14000359a10?, 0x140003599e0?)
    	/Users/dinesh.auti/go/pkg/mod/github.com/golang/protobuf@v1.4.3/proto/registry.go:104 +0xb8
    <http://github.com/pulumi/pulumi/sdk/v2/proto/go.init.0()|github.com/pulumi/pulumi/sdk/v2/proto/go.init.0()>
    	/Users/dinesh.auti/go/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.25.2/proto/go/analyzer.pb.go:963 +0x44
    exit status 2
    FAIL	<http://github.com/aetion/aep-base-infra/internal/resources|github.com/aetion/aep-base-infra/internal/resources>	0.393s
    Has anyone seen this before? I am using Pulumi version 3.35.1
    f
    2 replies
    Copy to Clipboard
  • f

    fancy-spoon-7206

    2 months ago
    What is the recommended way to ingest config for tests? I see that most of the examples online and in the official docs are hardcoded like below.
    func TestInfrastructure(t *testing.T) {
    	cwd, err := os.Getwd()
    	if err != nil {
    		t.FailNow()
    	}
        
        //  This gives an invalid memory address error!!!! 
        //	conf := config.New(ctx, "aep")
    	//  conf.RequireObject("config", &InternalConfig)
    
    	test := integration.ProgramTestOptions{
    		DestroyOnCleanup: true,
    		Quick:            true,
    		SkipRefresh:      true,
    		Verbose:          true,
    		Dir:              path.Join(cwd, "..", ".."),
    		// There seems to an issue with ingesting config from the stack yaml file using
    		// the Pulumi helper.ConfInit function. All the examples that I see on their site are hardcoded too.
    		Config: map[string]string{
    			"aws:region":  "us-east-1",
    			"aws:profile": "sandbox",
    .
    .
    .
    I tried using the RequireObject method to get the config from the stack yaml file and it failed with an
    invalid memory address or nil pointer dereference
    .