hcp.Hvn
Explore with Pulumi AI
The HVN resource allows you to manage a HashiCorp Virtual Network in HCP.
We recommend the following when selecting the CIDR block of an HVN:
The CIDR block value must be a private IPv4 CIDR block within the RFC1918 address space (10..., 192.168.., 172.[16-31]..*).
The CIDR block value must be the first IP address of the desired CIDR block. The helper
cidrsubnet("172.16.1.1/24", 0, 0)
will specify the first address of the CIDR block in the first argument.The CIDR block value must end between /16 and /25.
If the CIDR block values for your HCP HVN and your cloud provider’s virtual network overlap you will not be able to establish a connection. The following are default CIDR block values to be aware of: HCP HVN (172.25.16.0/20), AWS VPC (172.31.0.0/16), and Azure VNet (172.29.0.0/24). Avoid creating overlapping networks.
If you’re creating a HVN for use in production it’s recommended that you specify a CIDR block value that does not overlap with the other HVNs already created in your organization. You will not be able to connect two HVNs with overlapping CIDR block values.
Example Usage
using System.Collections.Generic;
using Pulumi;
using Hcp = Pulumi.Hcp;
return await Deployment.RunAsync(() =>
{
var example = new Hcp.Hvn("example", new()
{
CidrBlock = "172.25.16.0/20",
CloudProvider = "aws",
HvnId = "main-hvn",
Region = "us-west-2",
});
});
package main
import (
"github.com/grapl-security/pulumi-hcp/sdk/go/hcp"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := hcp.NewHvn(ctx, "example", &hcp.HvnArgs{
CidrBlock: pulumi.String("172.25.16.0/20"),
CloudProvider: pulumi.String("aws"),
HvnId: pulumi.String("main-hvn"),
Region: pulumi.String("us-west-2"),
})
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 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 example = new Hvn("example", HvnArgs.builder()
.cidrBlock("172.25.16.0/20")
.cloudProvider("aws")
.hvnId("main-hvn")
.region("us-west-2")
.build());
}
}
import pulumi
import pulumi_hcp as hcp
example = hcp.Hvn("example",
cidr_block="172.25.16.0/20",
cloud_provider="aws",
hvn_id="main-hvn",
region="us-west-2")
import * as pulumi from "@pulumi/pulumi";
import * as hcp from "@pulumi/hcp";
const example = new hcp.Hvn("example", {
cidrBlock: "172.25.16.0/20",
cloudProvider: "aws",
hvnId: "main-hvn",
region: "us-west-2",
});
resources:
example:
type: hcp:Hvn
properties:
cidrBlock: 172.25.16.0/20
cloudProvider: aws
hvnId: main-hvn
region: us-west-2
Create Hvn Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Hvn(name: string, args: HvnArgs, opts?: CustomResourceOptions);
@overload
def Hvn(resource_name: str,
args: HvnArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Hvn(resource_name: str,
opts: Optional[ResourceOptions] = None,
cloud_provider: Optional[str] = None,
hvn_id: Optional[str] = None,
region: Optional[str] = None,
cidr_block: Optional[str] = None)
func NewHvn(ctx *Context, name string, args HvnArgs, opts ...ResourceOption) (*Hvn, error)
public Hvn(string name, HvnArgs args, CustomResourceOptions? opts = null)
type: hcp:Hvn
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 HvnArgs
- 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 HvnArgs
- 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 HvnArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args HvnArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args HvnArgs
- 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 hvnResource = new Hcp.Hvn("hvnResource", new()
{
CloudProvider = "string",
HvnId = "string",
Region = "string",
CidrBlock = "string",
});
example, err := hcp.NewHvn(ctx, "hvnResource", &hcp.HvnArgs{
CloudProvider: pulumi.String("string"),
HvnId: pulumi.String("string"),
Region: pulumi.String("string"),
CidrBlock: pulumi.String("string"),
})
var hvnResource = new Hvn("hvnResource", HvnArgs.builder()
.cloudProvider("string")
.hvnId("string")
.region("string")
.cidrBlock("string")
.build());
hvn_resource = hcp.Hvn("hvnResource",
cloud_provider="string",
hvn_id="string",
region="string",
cidr_block="string")
const hvnResource = new hcp.Hvn("hvnResource", {
cloudProvider: "string",
hvnId: "string",
region: "string",
cidrBlock: "string",
});
type: hcp:Hvn
properties:
cidrBlock: string
cloudProvider: string
hvnId: string
region: string
Hvn 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 Hvn resource accepts the following input properties:
- Cloud
Provider string - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- Hvn
Id string - The ID of the HashiCorp Virtual Network (HVN).
- Region string
- The region where the HVN is located.
- Cidr
Block string - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
- Cloud
Provider string - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- Hvn
Id string - The ID of the HashiCorp Virtual Network (HVN).
- Region string
- The region where the HVN is located.
- Cidr
Block string - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
- cloud
Provider String - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- hvn
Id String - The ID of the HashiCorp Virtual Network (HVN).
- region String
- The region where the HVN is located.
- cidr
Block String - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
- cloud
Provider string - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- hvn
Id string - The ID of the HashiCorp Virtual Network (HVN).
- region string
- The region where the HVN is located.
- cidr
Block string - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
- cloud_
provider str - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- hvn_
id str - The ID of the HashiCorp Virtual Network (HVN).
- region str
- The region where the HVN is located.
- cidr_
block str - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
- cloud
Provider String - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- hvn
Id String - The ID of the HashiCorp Virtual Network (HVN).
- region String
- The region where the HVN is located.
- cidr
Block String - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
Outputs
All input properties are implicitly available as output properties. Additionally, the Hvn resource produces the following output properties:
- Created
At string - The time that the HVN was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Organization
Id string - The ID of the HCP organization where the HVN is located.
- Project
Id string - The ID of the HCP project where the HVN is located.
- Provider
Account stringId - The provider account ID where the HVN is located.
- Self
Link string - A unique URL identifying the HVN.
- State string
- The state of the HVN.
- Created
At string - The time that the HVN was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Organization
Id string - The ID of the HCP organization where the HVN is located.
- Project
Id string - The ID of the HCP project where the HVN is located.
- Provider
Account stringId - The provider account ID where the HVN is located.
- Self
Link string - A unique URL identifying the HVN.
- State string
- The state of the HVN.
- created
At String - The time that the HVN was created.
- id String
- The provider-assigned unique ID for this managed resource.
- organization
Id String - The ID of the HCP organization where the HVN is located.
- project
Id String - The ID of the HCP project where the HVN is located.
- provider
Account StringId - The provider account ID where the HVN is located.
- self
Link String - A unique URL identifying the HVN.
- state String
- The state of the HVN.
- created
At string - The time that the HVN was created.
- id string
- The provider-assigned unique ID for this managed resource.
- organization
Id string - The ID of the HCP organization where the HVN is located.
- project
Id string - The ID of the HCP project where the HVN is located.
- provider
Account stringId - The provider account ID where the HVN is located.
- self
Link string - A unique URL identifying the HVN.
- state string
- The state of the HVN.
- created_
at str - The time that the HVN was created.
- id str
- The provider-assigned unique ID for this managed resource.
- organization_
id str - The ID of the HCP organization where the HVN is located.
- project_
id str - The ID of the HCP project where the HVN is located.
- provider_
account_ strid - The provider account ID where the HVN is located.
- self_
link str - A unique URL identifying the HVN.
- state str
- The state of the HVN.
- created
At String - The time that the HVN was created.
- id String
- The provider-assigned unique ID for this managed resource.
- organization
Id String - The ID of the HCP organization where the HVN is located.
- project
Id String - The ID of the HCP project where the HVN is located.
- provider
Account StringId - The provider account ID where the HVN is located.
- self
Link String - A unique URL identifying the HVN.
- state String
- The state of the HVN.
Look up Existing Hvn Resource
Get an existing Hvn 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?: HvnState, opts?: CustomResourceOptions): Hvn
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cidr_block: Optional[str] = None,
cloud_provider: Optional[str] = None,
created_at: Optional[str] = None,
hvn_id: Optional[str] = None,
organization_id: Optional[str] = None,
project_id: Optional[str] = None,
provider_account_id: Optional[str] = None,
region: Optional[str] = None,
self_link: Optional[str] = None,
state: Optional[str] = None) -> Hvn
func GetHvn(ctx *Context, name string, id IDInput, state *HvnState, opts ...ResourceOption) (*Hvn, error)
public static Hvn Get(string name, Input<string> id, HvnState? state, CustomResourceOptions? opts = null)
public static Hvn get(String name, Output<String> id, HvnState 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.
- Cidr
Block string - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
- Cloud
Provider string - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- Created
At string - The time that the HVN was created.
- Hvn
Id string - The ID of the HashiCorp Virtual Network (HVN).
- Organization
Id string - The ID of the HCP organization where the HVN is located.
- Project
Id string - The ID of the HCP project where the HVN is located.
- Provider
Account stringId - The provider account ID where the HVN is located.
- Region string
- The region where the HVN is located.
- Self
Link string - A unique URL identifying the HVN.
- State string
- The state of the HVN.
- Cidr
Block string - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
- Cloud
Provider string - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- Created
At string - The time that the HVN was created.
- Hvn
Id string - The ID of the HashiCorp Virtual Network (HVN).
- Organization
Id string - The ID of the HCP organization where the HVN is located.
- Project
Id string - The ID of the HCP project where the HVN is located.
- Provider
Account stringId - The provider account ID where the HVN is located.
- Region string
- The region where the HVN is located.
- Self
Link string - A unique URL identifying the HVN.
- State string
- The state of the HVN.
- cidr
Block String - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
- cloud
Provider String - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- created
At String - The time that the HVN was created.
- hvn
Id String - The ID of the HashiCorp Virtual Network (HVN).
- organization
Id String - The ID of the HCP organization where the HVN is located.
- project
Id String - The ID of the HCP project where the HVN is located.
- provider
Account StringId - The provider account ID where the HVN is located.
- region String
- The region where the HVN is located.
- self
Link String - A unique URL identifying the HVN.
- state String
- The state of the HVN.
- cidr
Block string - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
- cloud
Provider string - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- created
At string - The time that the HVN was created.
- hvn
Id string - The ID of the HashiCorp Virtual Network (HVN).
- organization
Id string - The ID of the HCP organization where the HVN is located.
- project
Id string - The ID of the HCP project where the HVN is located.
- provider
Account stringId - The provider account ID where the HVN is located.
- region string
- The region where the HVN is located.
- self
Link string - A unique URL identifying the HVN.
- state string
- The state of the HVN.
- cidr_
block str - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
- cloud_
provider str - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- created_
at str - The time that the HVN was created.
- hvn_
id str - The ID of the HashiCorp Virtual Network (HVN).
- organization_
id str - The ID of the HCP organization where the HVN is located.
- project_
id str - The ID of the HCP project where the HVN is located.
- provider_
account_ strid - The provider account ID where the HVN is located.
- region str
- The region where the HVN is located.
- self_
link str - A unique URL identifying the HVN.
- state str
- The state of the HVN.
- cidr
Block String - The CIDR range of the HVN. If this is not provided, the service will provide a default value.
- cloud
Provider String - The provider where the HVN is located. The provider 'aws' is generally available and 'azure' is in public beta.
- created
At String - The time that the HVN was created.
- hvn
Id String - The ID of the HashiCorp Virtual Network (HVN).
- organization
Id String - The ID of the HCP organization where the HVN is located.
- project
Id String - The ID of the HCP project where the HVN is located.
- provider
Account StringId - The provider account ID where the HVN is located.
- region String
- The region where the HVN is located.
- self
Link String - A unique URL identifying the HVN.
- state String
- The state of the HVN.
Import
The import ID is {hvn_id}
$ pulumi import hcp:index/hvn:Hvn example main-hvn
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- hcp grapl-security/pulumi-hcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcp
Terraform Provider.