brash-painting-89833
04/12/2023, 6:16 PMvpc, err := ec2.NewVpc(ctx, name, &ec2.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
InstanceTenancy: pulumi.String("default"),
Tags: pulumi.StringMap{
"Name": pulumi.String(name),
},
})
and now I want to get the subnetsids (i know they don't exit yet, and this is the problem)
I basically want to use to create a eks nodeGroup, from the example: https://github.com/pulumi/examples/blob/master/aws-go-eks/main.go
I have the code bellow, but it gets the vpc and subnets id using a lookup that i can't do because the vpc is yet to exit
nodeGroup, err := eks.NewNodeGroup(ctx, "node-group-2", &eks.NodeGroupArgs{
ClusterName: eksCluster.Name,
NodeGroupName: pulumi.String("demo-eks-nodegroup-2"),
NodeRoleArn: pulumi.StringInput(nodeGroupRole.Arn),
SubnetIds: toPulumiStringArray(subnet.Ids),
ScalingConfig: &eks.NodeGroupScalingConfigArgs{
DesiredSize: <http://pulumi.Int|pulumi.Int>(2),
MaxSize: <http://pulumi.Int|pulumi.Int>(2),
MinSize: <http://pulumi.Int|pulumi.Int>(1),
},
})
I tried to use LookupVpcOutput
but wasn't able to get it working, mostly because of types and etc..
Does anyone have any suggestions? if i should use the lookup or something else.. if it's the lookup, some example would be nice, i had problems getting the filter to work.
Basically i want to be able to create my own vpc, and then make eks and etc use this vpc, it seems it should be a simple thing, but i guess i am not getting the right idea on inputs/outputssalmon-account-74572
04/12/2023, 6:19 PMawsx.ec2.NewVpc
then you’ll get a VPC, subnets, gateways, routes, route tables, etc. Right now you’re using aws.ec2.NewVpc
, which creates just the VPC.
For an example of how create a VPC using AWSX and then creating an EKS cluster, take a look at our Kubernetes on AWS template: https://www.pulumi.com/templates/kubernetes/aws/
The referenced template is found in our “templates” repository on GitHub: https://github.com/pulumi/templates/ (look for “kubernetes-aws-{lang}“)brash-painting-89833
04/12/2023, 6:25 PMsalmon-account-74572
04/12/2023, 6:31 PMbillowy-army-68599
04/12/2023, 6:33 PMnodeGroup, err := eks.NewNodeGroup(ctx, "node-group-2", &eks.NodeGroupArgs{
ClusterName: eksCluster.Name,
NodeGroupName: pulumi.String("demo-eks-nodegroup-2"),
NodeRoleArn: pulumi.StringInput(nodeGroupRole.Arn),
SubnetIds: vpc.privateSubnetIds,
ScalingConfig: &eks.NodeGroupScalingConfigArgs{
DesiredSize: <http://pulumi.Int|pulumi.Int>(2),
MaxSize: <http://pulumi.Int|pulumi.Int>(2),
MinSize: <http://pulumi.Int|pulumi.Int>(1),
},
})
salmon-account-74572
04/12/2023, 6:34 PMvpc
would be the name of the VPC created using AWSX, so vpc.privateSubnetIds
references the private subnets created in the VPC by Crosswalk for AWS (AWSX).brash-painting-89833
04/13/2023, 2:04 AM