magnificent-restaurant-97310
06/17/2022, 6:23 AMpulumi.Run(func(ctx *pulumi.Context) error {
_, err := orgpolicy.NewPolicy(ctx, "primary", &orgpolicy.PolicyArgs{
Parent: pulumi.String(org),
Name: pulumi.String("gcp.resourceLocations"),
Spec: &orgpolicy.PolicySpecArgs{
Rules: orgpolicy.PolicySpecRuleArray{
&orgpolicy.PolicySpecRuleArgs{
Enforce: pulumi.String("TRUE"),
Values: orgpolicy.PolicySpecRuleValues{
AllowedValues: []string{"region1", "region2"},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
but I’m getting an error :
cannot use orgpolicy.PolicySpecRuleValues{...} (type orgpolicy.PolicySpecRuleValues) as type orgpolicy.PolicySpecRuleValuesPtrInput in field value:
orgpolicy.PolicySpecRuleValues does not implement orgpolicy.PolicySpecRuleValuesPtrInput (missing ElementType method)
anyone experienced this?jolly-church-88521
06/17/2022, 7:57 AMDiagnostics:
pulumi:pulumi:Stack (foo.de-dev):
fatal error: sync: Unlock of unlocked RWMutex
fancy-spoon-7206
06/17/2022, 4:01 PMpulumi.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
fancy-spoon-7206
06/20/2022, 10:16 PMerror: 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>
fancy-spoon-7206
06/20/2022, 10:17 PMfancy-spoon-7206
06/20/2022, 10:17 PMv1.0.0-testplsignore.0
is a valid version?magnificent-helicopter-3467
06/21/2022, 6:45 PMfancy-spoon-7206
06/22/2022, 12:04 AMfunc 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.magnificent-helicopter-3467
06/22/2022, 10:38 PMsa, 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
?billowy-army-68599
06/22/2022, 10:47 PMCan 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 informationfancy-spoon-7206
06/25/2022, 4:28 AMfunc 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.1fancy-spoon-7206
07/04/2022, 9:24 PMfunc 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
.fancy-spoon-7206
07/04/2022, 9:27 PM=== RUN TestInfrastructure
--- FAIL: TestInfrastructure (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x30 pc=0x104ec8580]
prehistoric-sandwich-7272
07/10/2022, 1:04 PMclusterArgs
the subnet ID’s of the VPC I have created in a different stack.
I am getting the output from the stack reference like this:
stack, err := pulumi.NewStackReference(ctx, Name, nil)
if err != nil {
log.Fatalf("Got error while trying to get a new stack reference! Error: %s", err)
}
VpcPublicSubnetIdsOutput := stack.GetStringOutput(pulumi.String("vpcPublicSubnetIds"))
vpcPrivateSubnetIdsOutput := stack.GetStringOutput(pulumi.String("vpcPrivateSubnetIds"))
VpcPublicSubnetIds := pulumi.ToStringArrayOutput([]pulumi.StringOutput{VpcPublicSubnetIdsOutput})
vpcPrivateSubnetIds := pulumi.ToStringArrayOutput([]pulumi.StringOutput{vpcPrivateSubnetIdsOutput})
So VpcPublicSubnetIds & vpcPrivateSubnetIds are both of type pulumi.StringArrayOutput
But I can’t figure out how to pass the subnet ID’s to the clusterArgs, by indexing the elements from VpcPublicSubnetIds & vpcPrivateSubnetIds !
I tried doing it like this:
eksCluster, err := eks.NewCluster(ctx, values.Name, &eks.ClusterArgs{
Name: pulumi.StringPtr(values.Name),
VpcId: vpcId,
PublicSubnetIds: pulumi.StringArray{
pulumi.StringInput(VpcPublicSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(0))),
pulumi.StringInput(VpcPublicSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(1))),
pulumi.StringInput(VpcPublicSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(2))),
pulumi.StringInput(VpcPublicSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(3))),
},
PrivateSubnetIds: pulumi.StringArray{
pulumi.StringInput(vpcPrivateSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(0))),
pulumi.StringInput(vpcPrivateSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(1))),
pulumi.StringInput(vpcPrivateSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(2))),
pulumi.StringInput(vpcPrivateSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(3))),
},
what am I doing wrong?billowy-nightfall-59212
07/11/2022, 9:37 PMgcp firewall
from gcp nodepool
_, err = compute.NewFirewall(ctx, "prometheus-k8s-firewall", &compute.FirewallArgs{
Allows: compute.FirewallAllowArray{
&compute.FirewallAllowArgs{
Ports: pulumi.StringArray{
pulumi.String("8443"),
},
Protocol: pulumi.String("tcp"),
},
},
Direction: pulumi.String("INGRESS"),
Name: pulumi.String("prometheus-k8s-firewall"),
Network: network.SelfLink,
Project: pulumi.String(c.Project),
SourceRanges: pulumi.StringArray{
pulumi.String(c.Cluster.MasterCIDR),
},
TargetTags: pool.NodeConfig.Tags().ToStringArrayOutput(),
}, pulumi.Protect(true))
damp-ocean-83573
07/12/2022, 9:19 PMLoadBalancer
along with the annotation <http://networking.gke.io/load-balancer-type|networking.gke.io/load-balancer-type>: Internal
, seems like Pulumi isn’t populating the ingress IP correctly, i.e. status.LoadBalancer.Ingress
has length of 0. Anyone run into this problem before? Can’t seem to find anything online about it.ripe-shampoo-80285
07/14/2022, 1:26 AMfancy-spoon-7206
07/18/2022, 4:07 PMtype subnet struct {
Id pulumi.StringOutput
Az string
}
publicSubnet := make([]subnet, 0, 1)
for index, az := range azs {
publicSubnet = append(publicSubnet, subnet{
Id: PublicSubnets.Index(<http://pulumi.Int|pulumi.Int>(index)),
Az: az,
})
}
I would like to export publicSubnet, but that is not valid.fancy-spoon-7206
07/18/2022, 4:07 PMfancy-spoon-7206
07/18/2022, 4:09 PM{
"publicSubnets": [
{
"id": "subnet-02d7930bd",
"az": "us-east-2a"
},
{
"id": "subnet-0a89e59bb",
"az": "us-east-2b"
},
{
"id": "subnet-04658194f",
"az": "us-east-2c"
}
],
"privateSubnets": [
{
"id": "subnet-00a9f3a9d6",
"az": "us-east-2a"
},
{
"id": "subnet-026eed9351,
"az": "us-east-2b"
},
{
"id": "subnet-0bfabcc5f666637c1",
"az": "us-east-2c"
}
]
}
bland-florist-27487
07/19/2022, 12:35 PMbumpy-byte-21437
07/21/2022, 12:19 PMbumpy-byte-21437
07/21/2022, 12:19 PMpackage aks
import (
"fmt"
"<http://github.com/pulumi/pulumi-azure-native/sdk/go/azure/containerservice|github.com/pulumi/pulumi-azure-native/sdk/go/azure/containerservice>"
"<http://github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core|github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core>"
"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
)
type Aks struct {
pulumi.ResourceState
resourceId pulumi.StringOutput
name pulumi.StringOutput
}
type AksArgs struct {
EnableRBAC pulumi.BoolInput
ResourceName pulumi.StringInput
KubernetesVersion pulumi.StringInput
NodeResourceGroup pulumi.StringInput
ResourceGroup pulumi.StringInput
NodeCount pulumi.IntInput
Location pulumi.StringInput
}
func CreateAks(ctx *pulumi.Context, name string, args *AksArgs, opts ...pulumi.ResourceOption) (*Aks, error) {
aks := &Aks{}
err := ctx.RegisterComponentResource("resource:index:Aks", name, aks, opts...)
if err != nil {
return nil, err
}
rgs, err := core.NewResourceGroup(ctx, "resourceGroups", &core.ResourceGroupArgs{
Name: args.ResourceGroup,
Location: args.Location,
}, pulumi.Parent(aks))
if err != nil {
return nil, fmt.Errorf("error creating resource group: %v", err)
}
k8s, err := containerservice.NewManagedCluster(ctx, "akss", &containerservice.ManagedClusterArgs{
Location: rgs.Location,
AgentPoolProfiles: containerservice.ManagedClusterAgentPoolProfileArray{
&containerservice.ManagedClusterAgentPoolProfileArgs{
Count: args.NodeCount,
EnableAutoScaling: pulumi.Bool(false),
EnableNodePublicIP: pulumi.Bool(true),
Mode: pulumi.String("System"),
Name: pulumi.String("default"),
OsType: pulumi.String("Linux"),
Type: pulumi.String("VirtualMachineScaleSets"),
VmSize: pulumi.String("Standard_B2s"),
},
},
DnsPrefix: pulumi.String("akss"),
EnableRBAC: args.EnableRBAC,
Identity: &containerservice.ManagedClusterIdentityArgs{Type: containerservice.ResourceIdentityTypeSystemAssigned},
KubernetesVersion: args.KubernetesVersion,
NodeResourceGroup: args.NodeResourceGroup,
ResourceGroupName: rgs.Name,
ResourceName: args.ResourceName,
Sku: &containerservice.ManagedClusterSKUArgs{
Name: pulumi.String("Basic"),
Tier: pulumi.String("Free"),
},
}, pulumi.Parent(rgs))
if err != nil {
return nil, fmt.Errorf("error creating cluster: %v", err)
}
ctx.RegisterResourceOutputs(aks, pulumi.Map{
"resourceId": k8s.ID(),
"name": k8s.Name,
})
return aks, nil
}
busy-island-31180
07/21/2022, 11:05 PMbusy-island-31180
07/21/2022, 11:06 PMdry-engine-17210
07/22/2022, 12:15 AMbusy-island-31180
07/22/2022, 1:08 AMtype ManagedFieldsEntryArrayOutput struct{ *pulumi.OutputState }
such as in go/kubernetes/meta/v1/pulumiTypes.go
busy-island-31180
07/22/2022, 1:08 AMgorgeous-accountant-60580
07/22/2022, 9:19 PMbland-florist-27487
07/25/2022, 5:52 PMbland-florist-27487
07/25/2022, 5:52 PMfancy-spoon-7206
07/25/2022, 5:54 PMbland-florist-27487
07/25/2022, 5:55 PM