creamy-engine-1851
12/07/2020, 8:04 PMpulumi.StringArrayOutput
that I'm exporting through ctx.Export
. When I'm importing this through StackReference.GetOutput
in another stack I'm getting an pulumi.AnyOutput
. How do I convert it? Should I use .ApplyStringArray
in some way?gifted-city-99717
12/12/2020, 2:48 AMmicroscopic-agent-70604
12/17/2020, 12:46 PMambitious-salesmen-39356
12/17/2020, 7:10 PMelasticache.ClusterCacheNodeArrayOutput
and despite the fact that it appears to be just a slice of maps, it's not iterable.hallowed-agent-41624
12/18/2020, 12:48 PMtall-needle-56640
12/20/2020, 7:08 AMpulumi.RunWithContext()
can be run concurrently because it is not called within a lock. Is that desired? Or is all this concurrent code just to protect the state?
NOTE: I am trying to port this code to C#prehistoric-kite-30979
12/21/2020, 12:21 PMpulumi up
func Template(tmpl string, data interface{}) pulumi.StringOutput {
any := pulumi.Any(data)
return pulumi.All(tmpl, any).ApplyString(func(v interface{}) (string, error) {
args := v.([]interface{})
toParse := args[0].(string)
fields := args[1].(interface{})
Debug(fields, "test")
var buf bytes.Buffer
parsed, err := template.New("tmpl").Parse(toParse)
if err != nil {
return "", err
}
if err := parsed.Execute(&buf, fields); err != nil {
return "", err
}
return buf.String(), nil
})
}
important-appointment-55126
12/21/2020, 3:11 PMimportant-appointment-55126
12/21/2020, 3:12 PMimportant-appointment-55126
12/21/2020, 3:13 PMprehistoric-kite-30979
12/21/2020, 3:14 PMprehistoric-kite-30979
12/21/2020, 3:19 PMmap[string]interface
interface?important-appointment-55126
12/21/2020, 3:37 PMambitious-salesmen-39356
12/22/2020, 4:16 PMmicroscopic-agent-70604
12/25/2020, 8:53 PMfast-airplane-27344
12/29/2020, 12:08 AMmagnificent-restaurant-51456
01/05/2021, 8:00 AMproud-animal-24343
01/06/2021, 7:46 PMcmdutil.Diag().Infoerrf(diag.Message("", "%s installing"), label)
Shouldn't it us the same logging logic as other messages in that script, e.g...
logging.V(1).Infof("%s installing", label)
magnificent-restaurant-51456
01/07/2021, 6:46 AMmagnificent-restaurant-51456
01/07/2021, 8:40 AMbroad-dog-22463
01/07/2021, 4:03 PMmagnificent-restaurant-51456
01/12/2021, 9:42 AMmagnificent-restaurant-51456
01/12/2021, 11:25 AMpackage controllers
import (
"context"
"<http://github.com/pulumi/pulumi-azure/sdk/go/azure/core|github.com/pulumi/pulumi-azure/sdk/go/azure/core>"
"<http://github.com/pulumi/pulumi/sdk/go/pulumi|github.com/pulumi/pulumi/sdk/go/pulumi>"
"<http://github.com/pulumi/pulumi/sdk/v2/go/x/auto|github.com/pulumi/pulumi/sdk/v2/go/x/auto>"
"<http://github.com/revel/revel|github.com/revel/revel>"
)
type ResourceNames struct {
`RgName string `json:"rgname"``
`StorageName string `json:"storage_name"``
}
type CreateReq struct {
`StackName string `json:"stackname"``
`ProjectName string `json:"project_name"``
Resources []ResourceNames
}
func (c App) CreateResourceGroup() revel.Result {
ctx := context.Background()
c.Params.BindJSON(&<http://c.cr|c.cr>)
program := createRgProgram(c.rn.RgName)
s, err := auto.NewStackInlineSource(ctx, <http://c.cr|c.cr>.StackName, <http://c.cr|c.cr>.ProjectName, program)
if err != nil {
if auto.IsSelectStack404Error(err) {
return c.RenderText("stack already exists")
}
return c.RenderText(err.Error())
}
s.SetConfig(ctx, "azure.clientId", auto.ConfigValue{Value: ""})
return c.Render()
}
func createRgProgram(Name string) pulumi.RunFunc {
return func(ctx *pulumi.Context) error {
// our program defines a s3 website.
// here we create the bucket
resourceGroup, err := core.NewResourceGroup(ctx, "testpulumi", &core.ResourceGroupArgs{
Location: pulumi.String("westindia"),
Name: pulumi.String(Name),
Tags: pulumi.StringMap{
"Created_By": pulumi.String(""),
"Purpose": pulumi.String("test pulumi"),
"Start_Date": pulumi.String("16-Nov-2020"),
"End_Date": pulumi.String("16-Jan-2020"),
},
})
if err != nil {
return err
}
// export the website URL
ctx.Export("resourceGroupName", resourceGroup.Name)
return nil
}
}
magnificent-restaurant-51456
01/12/2021, 11:33 AMprehistoric-kite-30979
01/15/2021, 11:55 AMlemon-agent-27707
01/26/2021, 7:02 PMmammoth-honey-6147
02/01/2021, 4:16 PMctx.Export
? I've tried looping round:
for _, subnet := range subnets {
ctx.Export("Subnet CIDR", subnet.CidrBlock)
ctx.Export("Subnet AZ", subnet.AvailabilityZone)
}
But, predictably, it only prints the last element in the arraybig-state-95297
02/11/2021, 8:48 PMApplyT(...)
? E.g. eksCluster.NodeSecurityGroup.ApplyT(func() (*ec2.SecurityGroupRule, error) { return nil, fmt.Errorf("Test failure")})
. Can I inspect the error and return error from pulumi.Run
if the inner function fails?salmon-account-74572
02/26/2021, 8:00 PMApplyT
and ApplyString
variations of this snippet:
ipAddrList[0] = bastion.PrivateIp.ApplyString(func(ipAddr string) string {
return string(ipAddr)
})
What am I missing?icy-london-58403
03/04/2021, 5:56 PMgo
import (
"fmt"
"<http://github.com/pulumi/pulumi-aws/sdk/v3/go/aws/ec2|github.com/pulumi/pulumi-aws/sdk/v3/go/aws/ec2>"
"<http://github.com/pulumi/pulumi-aws/sdk/v3/go/aws/ec2transitgateway|github.com/pulumi/pulumi-aws/sdk/v3/go/aws/ec2transitgateway>"
"<http://github.com/pulumi/pulumi-aws/sdk/v3/go/aws/networkfirewall|github.com/pulumi/pulumi-aws/sdk/v3/go/aws/networkfirewall>"
"<http://github.com/pulumi/pulumi/sdk/v2/go/pulumi|github.com/pulumi/pulumi/sdk/v2/go/pulumi>"
)
---
vpc.NetworkFirewall, err = networkfirewall.NewFirewall(ctx, args.Vpc.Name, &networkfirewall.FirewallArgs{
Name: pulumi.String(args.Vpc.Name),
Description: pulumi.String("default policy"),
DeleteProtection: nil,
FirewallPolicyArn: networkFirewallPolicy.Arn,
FirewallPolicyChangeProtection: nil,
SubnetChangeProtection: nil,
SubnetMappings: firewallSubnets,
Tags: nil,
VpcId: vpc.VPC.ID(),
}, pulumi.Parent(vpc))
if err != nil {
ctx.Log.Error(fmt.Sprintf("Error creating firewall: %s", err), nil)
}
My Pulumi State Shows the VPC Endpoints are there and under Firewall Status
of the resource:
`firewallStatuses`:
json
[
{
"syncStates": [
{
"attachments": [
{
"endpointId": "vpce-038548f15fa6927f9",
"subnetId": "subnet-057838182632334cf"
}
],
"availabilityZone": "us-west-2b"
},
{
"attachments": [
{
"endpointId": "vpce-052c1fe00e3002431",
"subnetId": "subnet-0f24562826576b492"
}
],
"availabilityZone": "us-west-2d"
},
{
"attachments": [
{
"endpointId": "vpce-033845950fa44833d",
"subnetId": "subnet-02512de4df02e02cd"
}
],
"availabilityZone": "us-west-2a"
},
{
"attachments": [
{
"endpointId": "vpce-0f21d83ca409e4aaf",
"subnetId": "subnet-049fbb85c726d1b36"
}
],
"availabilityZone": "us-west-2c"
}
]
}
]
I just don’t know how to get those out of the Firewall in golang.
The docs show an outpu of the NetworkFirewall:
FirewallStatuses
[]FirewallFirewallStatusSo I would think I would just range over this and get the ID’s one at a time. But you can’t range over it and my IDE thinks that the type of
NetworkFirewall.FirewallStatuses
is networkfirewall.FirewallFirewallStatusArrayOutput
I can’t seem to get anything useful out of this. Any thoughts?