sparse-intern-71089
07/16/2021, 6:36 PMbillowy-army-68599
billowy-army-68599
brainy-rainbow-75025
07/16/2021, 6:41 PMbillowy-army-68599
GetVpc
, if you look in the docs here, you'll see the Go SDK actually mandates LookupVPC
- I agree it's not a great experiencebrainy-rainbow-75025
07/16/2021, 6:42 PMbillowy-army-68599
billowy-army-68599
billowy-army-68599
brainy-rainbow-75025
07/16/2021, 6:46 PMbrainy-rainbow-75025
07/16/2021, 6:48 PMGetVpc
call. I can pass the VPC Id as a string parameter to the containing struct for LookupVpc
billowy-army-68599
GetX
resources are actually rarely used, because most of the time you're not going to actually know the value of the resource and want to look it up.
Most folks use the LookupVpc
methods which allows more filtering:
https://github.com/pulumi/examples/blob/ca40203279f393c0c159dadcadc97c6007122997/aws-go-fargate/main.go#L21brainy-rainbow-75025
07/16/2021, 6:51 PMLookupVcp
is much easier to use, I just need to figure out how to specify which provider I want to use now. I think the docs should reflect that though rather than pointing me to the GetVpc
call.billowy-army-68599
brainy-rainbow-75025
07/16/2021, 6:53 PMbillowy-army-68599
billowy-army-68599
brainy-rainbow-75025
07/16/2021, 6:59 PMbrainy-rainbow-75025
07/16/2021, 7:00 PMproductionUSEast1, err := aws.NewProvider(ctx, "terraform-production", &aws.ProviderArgs{
Region: pulumi.String("us-east-1"),
})
brainy-rainbow-75025
07/16/2021, 7:00 PMbillowy-army-68599
billowy-army-68599
brainy-rainbow-75025
07/16/2021, 7:12 PMbrainy-rainbow-75025
07/16/2021, 7:15 PMbrainy-rainbow-75025
07/16/2021, 7:53 PMcannot use ctx (variable of type *pulumi.Context) as *pulumi.Context
billowy-army-68599
brainy-rainbow-75025
07/16/2021, 8:13 PMpulumi.StringArrayInput
with no direct built in conversions from pulumi.StringArray
makes for really messy code. I suspect this is related to the lack of generics in Go or some janky interface declarations. It's not difficult but if I threw a junior/mid at that code they'd be lost in a heartbeat.brainy-rainbow-75025
07/16/2021, 8:15 PMsubnetIds = pulumi.StringArray{
pulumi.String("subnet-00a852a567a95c34e"),
pulumi.String("subnet-0028f8824e50101fa"),
pulumi.String("subnet-05fa2f619b658b49e"),
}
brainy-rainbow-75025
07/16/2021, 8:16 PMgroupArgs := &rds.SubnetGroupArgs{
SubnetIds: subnetIds,
}
brainy-rainbow-75025
07/16/2021, 8:17 PMpulumi.StringArrayInput
type. I would think that the inheritance model would you say
type StringArray interface {}
brainy-rainbow-75025
07/16/2021, 8:18 PMbrainy-rainbow-75025
07/16/2021, 8:20 PMbrainy-rainbow-75025
07/16/2021, 8:21 PMbrainy-rainbow-75025
07/16/2021, 8:22 PMbillowy-army-68599
brainy-rainbow-75025
07/16/2021, 8:28 PMsubnetIds = pulumi.StringArray{
pulumi.String("subnet-00a852a567a95c34e"),
pulumi.String("subnet-0028f8824e50101fa"),
pulumi.String("subnet-05fa2f619b658b49e"),
}
brainy-rainbow-75025
07/16/2021, 8:29 PMfunc main() {
pulumi.Run(func(ctx *pulumi.Context) error {
productionUSEast1, err := aws.NewProvider(ctx, "terraform-production", &aws.ProviderArgs{
Region: pulumi.String("us-east-1"),
})
if err != nil {
return err
}
groupArgs := &rds.SubnetGroupArgs{
SubnetIds: subnetIds,
}
_, err = rds.NewSubnetGroup(ctx, "nextgen-data",groupArgs,pulumi.Provider(productionUSEast1),
)
return nil
})
}
brainy-rainbow-75025
07/16/2021, 8:30 PMsubnetIds
but that just seems..... antithetical to how it should work. Then the code is throwing an error about the ctx
not being of type *pulumi.Context
bored-table-20691
07/16/2021, 9:02 PMbrainy-rainbow-75025
07/16/2021, 9:06 PMbrainy-rainbow-75025
07/16/2021, 9:06 PMbrainy-rainbow-75025
07/16/2021, 9:07 PMbored-table-20691
07/16/2021, 9:07 PMbored-table-20691
07/16/2021, 9:08 PMbrainy-rainbow-75025
07/16/2021, 9:08 PMbrainy-rainbow-75025
07/16/2021, 9:09 PMbored-table-20691
07/16/2021, 9:09 PMbored-table-20691
07/16/2021, 9:11 PMApply
, but overall, it works reasonably well, and the productivity I’ve found with having things auto-complete, getting type errors, etc has been super helpful.bored-table-20691
07/16/2021, 9:12 PMbored-table-20691
07/16/2021, 9:17 PMbrainy-rainbow-75025
07/16/2021, 9:23 PM