1. Packages
  2. HCP
  3. API Docs
  4. HvnRoute
HashiCorp Cloud Platform (HCP) v0.1.14 published on Friday, Dec 2, 2022 by Grapl Security

hcp.HvnRoute

Explore with Pulumi AI

hcp logo
HashiCorp Cloud Platform (HCP) v0.1.14 published on Friday, Dec 2, 2022 by Grapl Security

    Import

    The import ID is {hvn_id}:{hvn_route_id}

     $ pulumi import hcp:index/hvnRoute:HvnRoute example main-hvn:example-hvn-route
    

    Example Usage

    using System.Collections.Generic;
    using Pulumi;
    using Aws = Pulumi.Aws;
    using Hcp = Pulumi.Hcp;
    
    return await Deployment.RunAsync(() => 
    {
        var main = new Hcp.Hvn("main", new()
        {
            HvnId = "main-hvn",
            CloudProvider = "aws",
            Region = "us-west-2",
            CidrBlock = "172.25.16.0/20",
        });
    
        // Creating a peering and a route for it.
        var peerVpc = new Aws.Ec2.Vpc("peerVpc", new()
        {
            CidrBlock = "192.168.0.0/20",
        });
    
        var example = new Hcp.AwsNetworkPeering("example", new()
        {
            PeeringId = "peer-example",
            HvnId = main.HvnId,
            PeerVpcId = peerVpc.Id,
            PeerAccountId = peerVpc.OwnerId,
            PeerVpcRegion = "us-west-2",
        });
    
        var peerVpcPeeringConnectionAccepter = new Aws.Ec2.VpcPeeringConnectionAccepter("peerVpcPeeringConnectionAccepter", new()
        {
            VpcPeeringConnectionId = example.ProviderPeeringId,
            AutoAccept = true,
        });
    
        var example_peering_route = new Hcp.HvnRoute("example-peering-route", new()
        {
            HvnLink = main.SelfLink,
            HvnRouteId = "peering-route",
            DestinationCidr = peerVpc.CidrBlock,
            TargetLink = example.SelfLink,
        });
    
    });
    
    package main
    
    import (
    	"github.com/grapl-security/pulumi-hcp/sdk/go/hcp"
    	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		main, err := hcp.NewHvn(ctx, "main", &hcp.HvnArgs{
    			HvnId:         pulumi.String("main-hvn"),
    			CloudProvider: pulumi.String("aws"),
    			Region:        pulumi.String("us-west-2"),
    			CidrBlock:     pulumi.String("172.25.16.0/20"),
    		})
    		if err != nil {
    			return err
    		}
    		peerVpc, err := ec2.NewVpc(ctx, "peerVpc", &ec2.VpcArgs{
    			CidrBlock: pulumi.String("192.168.0.0/20"),
    		})
    		if err != nil {
    			return err
    		}
    		example, err := hcp.NewAwsNetworkPeering(ctx, "example", &hcp.AwsNetworkPeeringArgs{
    			PeeringId:     pulumi.String("peer-example"),
    			HvnId:         main.HvnId,
    			PeerVpcId:     peerVpc.ID(),
    			PeerAccountId: peerVpc.OwnerId,
    			PeerVpcRegion: pulumi.String("us-west-2"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewVpcPeeringConnectionAccepter(ctx, "peerVpcPeeringConnectionAccepter", &ec2.VpcPeeringConnectionAccepterArgs{
    			VpcPeeringConnectionId: example.ProviderPeeringId,
    			AutoAccept:             pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = hcp.NewHvnRoute(ctx, "example-peering-route", &hcp.HvnRouteArgs{
    			HvnLink:         main.SelfLink,
    			HvnRouteId:      pulumi.String("peering-route"),
    			DestinationCidr: peerVpc.CidrBlock,
    			TargetLink:      example.SelfLink,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.hcp.Hvn;
    import com.pulumi.hcp.HvnArgs;
    import com.pulumi.aws.ec2.Vpc;
    import com.pulumi.aws.ec2.VpcArgs;
    import com.pulumi.hcp.AwsNetworkPeering;
    import com.pulumi.hcp.AwsNetworkPeeringArgs;
    import com.pulumi.aws.ec2.VpcPeeringConnectionAccepter;
    import com.pulumi.aws.ec2.VpcPeeringConnectionAccepterArgs;
    import com.pulumi.hcp.HvnRoute;
    import com.pulumi.hcp.HvnRouteArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var main = new Hvn("main", HvnArgs.builder()        
                .hvnId("main-hvn")
                .cloudProvider("aws")
                .region("us-west-2")
                .cidrBlock("172.25.16.0/20")
                .build());
    
            var peerVpc = new Vpc("peerVpc", VpcArgs.builder()        
                .cidrBlock("192.168.0.0/20")
                .build());
    
            var example = new AwsNetworkPeering("example", AwsNetworkPeeringArgs.builder()        
                .peeringId("peer-example")
                .hvnId(main.hvnId())
                .peerVpcId(peerVpc.id())
                .peerAccountId(peerVpc.ownerId())
                .peerVpcRegion("us-west-2")
                .build());
    
            var peerVpcPeeringConnectionAccepter = new VpcPeeringConnectionAccepter("peerVpcPeeringConnectionAccepter", VpcPeeringConnectionAccepterArgs.builder()        
                .vpcPeeringConnectionId(example.providerPeeringId())
                .autoAccept(true)
                .build());
    
            var example_peering_route = new HvnRoute("example-peering-route", HvnRouteArgs.builder()        
                .hvnLink(main.selfLink())
                .hvnRouteId("peering-route")
                .destinationCidr(peerVpc.cidrBlock())
                .targetLink(example.selfLink())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    import pulumi_hcp as hcp
    
    main = hcp.Hvn("main",
        hvn_id="main-hvn",
        cloud_provider="aws",
        region="us-west-2",
        cidr_block="172.25.16.0/20")
    # Creating a peering and a route for it.
    peer_vpc = aws.ec2.Vpc("peerVpc", cidr_block="192.168.0.0/20")
    example = hcp.AwsNetworkPeering("example",
        peering_id="peer-example",
        hvn_id=main.hvn_id,
        peer_vpc_id=peer_vpc.id,
        peer_account_id=peer_vpc.owner_id,
        peer_vpc_region="us-west-2")
    peer_vpc_peering_connection_accepter = aws.ec2.VpcPeeringConnectionAccepter("peerVpcPeeringConnectionAccepter",
        vpc_peering_connection_id=example.provider_peering_id,
        auto_accept=True)
    example_peering_route = hcp.HvnRoute("example-peering-route",
        hvn_link=main.self_link,
        hvn_route_id="peering-route",
        destination_cidr=peer_vpc.cidr_block,
        target_link=example.self_link)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as hcp from "@grapl/pulumi-hcp";
    
    const main = new hcp.Hvn("main", {
        hvnId: "main-hvn",
        cloudProvider: "aws",
        region: "us-west-2",
        cidrBlock: "172.25.16.0/20",
    });
    // Creating a peering and a route for it.
    const peerVpc = new aws.ec2.Vpc("peerVpc", {cidrBlock: "192.168.0.0/20"});
    const example = new hcp.AwsNetworkPeering("example", {
        peeringId: "peer-example",
        hvnId: main.hvnId,
        peerVpcId: peerVpc.id,
        peerAccountId: peerVpc.ownerId,
        peerVpcRegion: "us-west-2",
    });
    const peerVpcPeeringConnectionAccepter = new aws.ec2.VpcPeeringConnectionAccepter("peerVpcPeeringConnectionAccepter", {
        vpcPeeringConnectionId: example.providerPeeringId,
        autoAccept: true,
    });
    const example_peering_route = new hcp.HvnRoute("example-peering-route", {
        hvnLink: main.selfLink,
        hvnRouteId: "peering-route",
        destinationCidr: peerVpc.cidrBlock,
        targetLink: example.selfLink,
    });
    
    resources:
      main:
        type: hcp:Hvn
        properties:
          hvnId: main-hvn
          cloudProvider: aws
          region: us-west-2
          cidrBlock: 172.25.16.0/20
      # Creating a peering and a route for it.
      peerVpc:
        type: aws:ec2:Vpc
        properties:
          cidrBlock: 192.168.0.0/20
      example:
        type: hcp:AwsNetworkPeering
        properties:
          peeringId: peer-example
          hvnId: ${main.hvnId}
          peerVpcId: ${peerVpc.id}
          peerAccountId: ${peerVpc.ownerId}
          peerVpcRegion: us-west-2
      peerVpcPeeringConnectionAccepter:
        type: aws:ec2:VpcPeeringConnectionAccepter
        properties:
          vpcPeeringConnectionId: ${example.providerPeeringId}
          autoAccept: true
      example-peering-route:
        type: hcp:HvnRoute
        properties:
          hvnLink: ${main.selfLink}
          hvnRouteId: peering-route
          destinationCidr: ${peerVpc.cidrBlock}
          targetLink: ${example.selfLink}
    

    Create HvnRoute Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new HvnRoute(name: string, args: HvnRouteArgs, opts?: CustomResourceOptions);
    @overload
    def HvnRoute(resource_name: str,
                 args: HvnRouteArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def HvnRoute(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 destination_cidr: Optional[str] = None,
                 hvn_link: Optional[str] = None,
                 hvn_route_id: Optional[str] = None,
                 target_link: Optional[str] = None)
    func NewHvnRoute(ctx *Context, name string, args HvnRouteArgs, opts ...ResourceOption) (*HvnRoute, error)
    public HvnRoute(string name, HvnRouteArgs args, CustomResourceOptions? opts = null)
    public HvnRoute(String name, HvnRouteArgs args)
    public HvnRoute(String name, HvnRouteArgs args, CustomResourceOptions options)
    
    type: hcp:HvnRoute
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args HvnRouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args HvnRouteArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args HvnRouteArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args HvnRouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args HvnRouteArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var hvnRouteResource = new Hcp.HvnRoute("hvnRouteResource", new()
    {
        DestinationCidr = "string",
        HvnLink = "string",
        HvnRouteId = "string",
        TargetLink = "string",
    });
    
    example, err := hcp.NewHvnRoute(ctx, "hvnRouteResource", &hcp.HvnRouteArgs{
    	DestinationCidr: pulumi.String("string"),
    	HvnLink:         pulumi.String("string"),
    	HvnRouteId:      pulumi.String("string"),
    	TargetLink:      pulumi.String("string"),
    })
    
    var hvnRouteResource = new HvnRoute("hvnRouteResource", HvnRouteArgs.builder()
        .destinationCidr("string")
        .hvnLink("string")
        .hvnRouteId("string")
        .targetLink("string")
        .build());
    
    hvn_route_resource = hcp.HvnRoute("hvnRouteResource",
        destination_cidr="string",
        hvn_link="string",
        hvn_route_id="string",
        target_link="string")
    
    const hvnRouteResource = new hcp.HvnRoute("hvnRouteResource", {
        destinationCidr: "string",
        hvnLink: "string",
        hvnRouteId: "string",
        targetLink: "string",
    });
    
    type: hcp:HvnRoute
    properties:
        destinationCidr: string
        hvnLink: string
        hvnRouteId: string
        targetLink: string
    

    HvnRoute Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The HvnRoute resource accepts the following input properties:

    DestinationCidr string
    The destination CIDR of the HVN route.
    HvnLink string
    The self_link of the HashiCorp Virtual Network (HVN).
    HvnRouteId string
    The ID of the HVN route.
    TargetLink string
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment
    DestinationCidr string
    The destination CIDR of the HVN route.
    HvnLink string
    The self_link of the HashiCorp Virtual Network (HVN).
    HvnRouteId string
    The ID of the HVN route.
    TargetLink string
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment
    destinationCidr String
    The destination CIDR of the HVN route.
    hvnLink String
    The self_link of the HashiCorp Virtual Network (HVN).
    hvnRouteId String
    The ID of the HVN route.
    targetLink String
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment
    destinationCidr string
    The destination CIDR of the HVN route.
    hvnLink string
    The self_link of the HashiCorp Virtual Network (HVN).
    hvnRouteId string
    The ID of the HVN route.
    targetLink string
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment
    destination_cidr str
    The destination CIDR of the HVN route.
    hvn_link str
    The self_link of the HashiCorp Virtual Network (HVN).
    hvn_route_id str
    The ID of the HVN route.
    target_link str
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment
    destinationCidr String
    The destination CIDR of the HVN route.
    hvnLink String
    The self_link of the HashiCorp Virtual Network (HVN).
    hvnRouteId String
    The ID of the HVN route.
    targetLink String
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment

    Outputs

    All input properties are implicitly available as output properties. Additionally, the HvnRoute resource produces the following output properties:

    CreatedAt string
    The time that the HVN route was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    SelfLink string
    A unique URL identifying the HVN route.
    State string
    The state of the HVN route.
    CreatedAt string
    The time that the HVN route was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    SelfLink string
    A unique URL identifying the HVN route.
    State string
    The state of the HVN route.
    createdAt String
    The time that the HVN route was created.
    id String
    The provider-assigned unique ID for this managed resource.
    selfLink String
    A unique URL identifying the HVN route.
    state String
    The state of the HVN route.
    createdAt string
    The time that the HVN route was created.
    id string
    The provider-assigned unique ID for this managed resource.
    selfLink string
    A unique URL identifying the HVN route.
    state string
    The state of the HVN route.
    created_at str
    The time that the HVN route was created.
    id str
    The provider-assigned unique ID for this managed resource.
    self_link str
    A unique URL identifying the HVN route.
    state str
    The state of the HVN route.
    createdAt String
    The time that the HVN route was created.
    id String
    The provider-assigned unique ID for this managed resource.
    selfLink String
    A unique URL identifying the HVN route.
    state String
    The state of the HVN route.

    Look up Existing HvnRoute Resource

    Get an existing HvnRoute resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: HvnRouteState, opts?: CustomResourceOptions): HvnRoute
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            created_at: Optional[str] = None,
            destination_cidr: Optional[str] = None,
            hvn_link: Optional[str] = None,
            hvn_route_id: Optional[str] = None,
            self_link: Optional[str] = None,
            state: Optional[str] = None,
            target_link: Optional[str] = None) -> HvnRoute
    func GetHvnRoute(ctx *Context, name string, id IDInput, state *HvnRouteState, opts ...ResourceOption) (*HvnRoute, error)
    public static HvnRoute Get(string name, Input<string> id, HvnRouteState? state, CustomResourceOptions? opts = null)
    public static HvnRoute get(String name, Output<String> id, HvnRouteState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CreatedAt string
    The time that the HVN route was created.
    DestinationCidr string
    The destination CIDR of the HVN route.
    HvnLink string
    The self_link of the HashiCorp Virtual Network (HVN).
    HvnRouteId string
    The ID of the HVN route.
    SelfLink string
    A unique URL identifying the HVN route.
    State string
    The state of the HVN route.
    TargetLink string
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment
    CreatedAt string
    The time that the HVN route was created.
    DestinationCidr string
    The destination CIDR of the HVN route.
    HvnLink string
    The self_link of the HashiCorp Virtual Network (HVN).
    HvnRouteId string
    The ID of the HVN route.
    SelfLink string
    A unique URL identifying the HVN route.
    State string
    The state of the HVN route.
    TargetLink string
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment
    createdAt String
    The time that the HVN route was created.
    destinationCidr String
    The destination CIDR of the HVN route.
    hvnLink String
    The self_link of the HashiCorp Virtual Network (HVN).
    hvnRouteId String
    The ID of the HVN route.
    selfLink String
    A unique URL identifying the HVN route.
    state String
    The state of the HVN route.
    targetLink String
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment
    createdAt string
    The time that the HVN route was created.
    destinationCidr string
    The destination CIDR of the HVN route.
    hvnLink string
    The self_link of the HashiCorp Virtual Network (HVN).
    hvnRouteId string
    The ID of the HVN route.
    selfLink string
    A unique URL identifying the HVN route.
    state string
    The state of the HVN route.
    targetLink string
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment
    created_at str
    The time that the HVN route was created.
    destination_cidr str
    The destination CIDR of the HVN route.
    hvn_link str
    The self_link of the HashiCorp Virtual Network (HVN).
    hvn_route_id str
    The ID of the HVN route.
    self_link str
    A unique URL identifying the HVN route.
    state str
    The state of the HVN route.
    target_link str
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment
    createdAt String
    The time that the HVN route was created.
    destinationCidr String
    The destination CIDR of the HVN route.
    hvnLink String
    The self_link of the HashiCorp Virtual Network (HVN).
    hvnRouteId String
    The ID of the HVN route.
    selfLink String
    A unique URL identifying the HVN route.
    state String
    The state of the HVN route.
    targetLink String
    A unique URL identifying the target of the HVN route. Examples of the target: aws_network_peering, aws_transit_gateway_attachment

    Package Details

    Repository
    hcp grapl-security/pulumi-hcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the hcp Terraform Provider.
    hcp logo
    HashiCorp Cloud Platform (HCP) v0.1.14 published on Friday, Dec 2, 2022 by Grapl Security