Terraform module to create subnets resource on google.
This project deploys a Google Cloud infrastructure using Terraform to create Subnet .
To get started, make sure you have configured your GCP provider. You can use the following code as a starting point:
module "subnet" {
source = "git::https://github.com/slovink/terraform-google-subnets.git?ref=v1.0.0"
name = "ops"
environment = "test"
subnet_names = ["subnet-1", "subnet-2"]
gcp_region = "asia-northeast1"
network = module.vpc.vpc_id
ip_cidr_range = ["10.10.1.0/24", "10.10.5.0/24"]
}
Make sure to configure the variables according to your requirements.
For detailed examples on how to use this module, please refer to the Examples directory within this repository.
Your Name Replace MIT and slovink with the appropriate license and your information. Feel free to expand this README with additional details or usage instructions as needed for your specific use case.
This project is licensed under the MIT License - see the LICENSE file for details.
Name | Version |
---|---|
terraform | >=1.7.4 |
>= 3.50, < 5.0 |
Name | Version |
---|---|
>= 3.50, < 5.0 |
Name | Source | Version |
---|---|---|
labels | git::https://github.com/slovink/terraform-google-labels.git | v1.0.0 |
Name | Type |
---|---|
google_compute_address.default | resource |
google_compute_route.default | resource |
google_compute_router.default | resource |
google_compute_router_nat.nat | resource |
google_compute_subnetwork.subnetwork | resource |
google_client_config.current | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
address_enabled | Toggle to enable or disable address functionality. | bool |
true |
no |
asn | Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN, either 16-bit or 32-bit. | number |
64514 |
no |
description | (Optional) An optional description of the VPC. The resource must be recreated to modify this field.Default is ''. | string |
"" |
no |
dest_range | The destination range of outgoing packets that this route applies to. Only IPv4 is supported. | string |
"0.0.0.0/0" |
no |
enabled | Toggle to enable or disable the main functionality. | bool |
true |
no |
environment | Environment (e.g. prod , dev , staging ). |
string |
"" |
no |
filter | Specifies the desired filtering of logs on this NAT. | string |
"ERRORS_ONLY" |
no |
gcp_region | Google Cloud region | string |
"europe-west3" |
no |
icmp_idle_timeout_sec | (Optional) Timeout (in seconds) for ICMP connections. Defaults to 30s if not set. | number |
30 |
no |
ip_cidr_range | (Required) The range of internal addresses that are owned by this subnetwork. Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or 192.168.0.0/16. Ranges must be unique and non-overlapping within a network. Only IPv4 is supported. | list(string) |
[ |
no |
ip_version | (Optional) The IP Version that will be used by this address. The default value is IPV4. Possible values are: IPV4, IPV6. | string |
"IPV4" |
no |
ipv6_access_type | The access type of IPv6 address this subnet holds. | string |
"EXTERNAL" |
no |
label_order | Label order, e.g. sequence of application name and environment name ,environment ,'attribute' [webserver ,qa ,devops ,public ,] . |
list(any) |
[ |
no |
log_config | (Optional) Logging options for the subnetwork flow logs. Setting this value to 'null' will disable them. See https://www.terraform.io/docs/providers/google/r/compute_subnetwork.html for more information and examples. | any |
null |
no |
managedby | ManagedBy, eg 'slovink'. | string |
"slovink" |
no |
module_timeouts | (Optional) How long certain operations (per resource type) are allowed to take before being considered to have failed. | any |
{} |
no |
name | The name of the resource, provided by the client when initially creating the resource. | string |
"" |
no |
nat_ip_allocate_option | How external IPs should be allocated for this NAT. | string |
"MANUAL_ONLY" |
no |
network | (Required) The VPC network the subnets belong to. Only networks that are in the distributed mode can have subnetworks. | string |
"" |
no |
next_hop_gateway | URL to a gateway that should handle matching packets. | string |
"default-internet-gateway" |
no |
priority | The priority of this route. | number |
1000 |
no |
private_ip_google_access | (Optional) When enabled, VMs in this subnetwork without external IP addresses can access Google APIs and services by using Private Google Access. | bool |
true |
no |
purpose | - (Optional) The purpose of the resource. This field can be either PRIVATE_RFC_1918, REGIONAL_MANAGED_PROXY, GLOBAL_MANAGED_PROXY, or PRIVATE_SERVICE_CONNECT | string |
"" |
no |
repository | Terraform current module repo | string |
"https://github.com/slovink/terraform-google-subnets" |
no |
route_enabled | Toggle to enable or disable routing functionality. | bool |
true |
no |
router_enabled | Toggle to enable or disable the router. | bool |
true |
no |
router_nat_enabled | Toggle to enable or disable NAT functionality for the router. | bool |
true |
no |
secondary_ip_ranges | An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange of the subnetwork. The alias IPs may belong to either primary or secondary ranges. | any |
[] |
no |
source_subnetwork_ip_ranges_to_nat | How NAT should be configured per Subnetwork. | string |
"ALL_SUBNETWORKS_ALL_IP_RANGES" |
no |
subnet_names | The name of the resource, provided by the client when initially creating the resource. | list(string) |
[] |
no |
udp_idle_timeout_sec | (Optional) Timeout (in seconds) for UDP connections. Defaults to 30s if not set. | number |
30 |
no |
Name | Description |
---|---|
address_name | The name of the GCP address. |
address_project | The project of the GCP address. |
address_region | The region of the GCP address. |
route_id | The ID of the GCP route. |
route_next_hop_network | The next hop network of the GCP route. |
route_self_link | The self-link of the GCP route. |
router_creation_timestamp | The timestamp when the GCP router was created. |
router_id | The ID of the GCP router. |
router_nat_name | The name of the GCP router NAT configuration. |
router_nat_router | The router associated with the GCP router NAT configuration. |
router_net_project | The project of the GCP router NAT configuration. |
router_net_region | The region of the GCP router NAT configuration. |
router_self_link | The self-link of the GCP router. |
subnet_creation_timestamp | The timestamp when the GCP subnetwork was created. |
subnet_external_ipv6_prefix | The external IPv6 prefix of the GCP subnetwork. |
subnet_gateway_address | The gateway address of the GCP subnetwork. |
subnet_id | The ID of the GCP subnetwork. |
subnet_ipv6_cidr_range | The IPv6 CIDR range of the GCP subnetwork. |
subnet_name | The name of the GCP subnetwork. |
subnet_self_link | The self-link of the GCP subnetwork. |