adorable-engineer-69963
08/04/2023, 10:02 AMpackage main
import (
"<http://github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2|github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2>"
"<http://github.com/pulumi/pulumi-aws/sdk/v4/go/aws/neptune|github.com/pulumi/pulumi-aws/sdk/v4/go/aws/neptune>"
"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
)
func() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a new VPC
vpc, err := ec2.NewVpc(ctx, "testVpc", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
})
if err != nil {
return err
}
// Create a new Subnet within the VPC
subnet, err := ec2.NewSubnet(ctx, "testSubnet", &ec2.SubnetArgs{
VpcId: vpc.ID(),
CidrBlock: pulumi.String("10.0.1.0/24"),
})
if err != nil {
return err
}
// Create a Neptune Subnet Group using the created subnet
neptuneSubnetGroup, err := neptune.NewSubnetGroup(ctx, "testNeptuneSubnetGroup", &neptune.SubnetGroupArgs{
SubnetIds: pulumi.StringArray{
subnet.ID(),
},
Description: pulumi.String("Neptune Subnet Group created by Pulumi"),
})
// Create a Neptune Cluster in the VPC
_, err = neptune.NewCluster(ctx, "neptuneCluster", &neptune.ClusterArgs{
Engine: pulumi.String("neptune"),
NeptuneSubnetGroupName: neptuneSubnetGroup.Name,
})
if err != nil {
return err
}
// Export the IDs of the created resources
ctx.Export("vpcId", vpc.ID())
ctx.Export("subnetId", subnet.ID())
ctx.Export("neptuneSubnetGroupId", neptuneSubnetGroup.ID())
return nil
})
}
salmon-account-74572
08/04/2023, 3:45 PMLookupVpc
function to let you “get” information for an existing VPC.adorable-engineer-69963
08/05/2023, 12:52 PMsalmon-account-74572
08/05/2023, 7:30 PM