Add end-to-end tests for net-address
This commit is contained in:
parent
0e39676c99
commit
8afdf66a09
|
@ -12,14 +12,17 @@ module "addresses" {
|
|||
project_id = var.project_id
|
||||
external_addresses = {
|
||||
one = { region = "europe-west1" }
|
||||
two = { region = "europe-west2" }
|
||||
two = {
|
||||
region = "europe-west2"
|
||||
tier = "STANDARD"
|
||||
}
|
||||
}
|
||||
global_addresses = {
|
||||
app-1 = {}
|
||||
app-2 = {}
|
||||
}
|
||||
}
|
||||
# tftest modules=1 resources=4 inventory=external.yaml
|
||||
# tftest modules=1 resources=4 inventory=external.yaml e2e
|
||||
```
|
||||
|
||||
### Internal addresses
|
||||
|
@ -35,13 +38,13 @@ module "addresses" {
|
|||
subnetwork = var.subnet.self_link
|
||||
}
|
||||
ilb-2 = {
|
||||
address = "10.0.0.2"
|
||||
address = "10.0.16.2"
|
||||
region = var.region
|
||||
subnetwork = var.subnet.self_link
|
||||
}
|
||||
}
|
||||
}
|
||||
# tftest modules=1 resources=2 inventory=internal.yaml
|
||||
# tftest modules=1 resources=2 inventory=internal.yaml e2e
|
||||
```
|
||||
|
||||
### IPv6 addresses
|
||||
|
@ -55,7 +58,7 @@ module "addresses" {
|
|||
external_addresses = {
|
||||
nlb = {
|
||||
region = var.region
|
||||
subnetwork = var.subnet.self_link
|
||||
subnetwork = module.vpc.subnets["${var.region}/ipv6-external"].self_link
|
||||
ipv6 = {
|
||||
endpoint_type = "NETLB"
|
||||
}
|
||||
|
@ -66,16 +69,16 @@ module "addresses" {
|
|||
ipv6 = {}
|
||||
purpose = "SHARED_LOADBALANCER_VIP"
|
||||
region = var.region
|
||||
subnetwork = var.subnet.self_link
|
||||
subnetwork = module.vpc.subnets["${var.region}/ipv6-internal"].self_link
|
||||
}
|
||||
vm = {
|
||||
ipv6 = {}
|
||||
region = var.region
|
||||
subnetwork = var.subnet.self_link
|
||||
subnetwork = module.vpc.subnets["${var.region}/ipv6-internal"].self_link
|
||||
}
|
||||
}
|
||||
}
|
||||
# tftest modules=1 resources=3 inventory=ipv6.yaml
|
||||
# tftest modules=2 resources=8 fixtures=fixtures/net-vpc-ipv6.tf inventory=ipv6.yaml e2e
|
||||
```
|
||||
|
||||
### PSA addresses
|
||||
|
@ -92,7 +95,7 @@ module "addresses" {
|
|||
}
|
||||
}
|
||||
}
|
||||
# tftest modules=1 resources=1 inventory=psa.yaml
|
||||
# tftest modules=1 resources=1 inventory=psa.yaml e2e
|
||||
```
|
||||
|
||||
### PSC addresses
|
||||
|
@ -112,7 +115,7 @@ module "addresses" {
|
|||
}
|
||||
}
|
||||
}
|
||||
# tftest modules=1 resources=2 inventory=psc.yaml
|
||||
# tftest modules=1 resources=2 inventory=psc.yaml e2e
|
||||
```
|
||||
|
||||
# IPSec Interconnect addresses
|
||||
|
@ -136,20 +139,20 @@ module "addresses" {
|
|||
}
|
||||
}
|
||||
}
|
||||
# tftest modules=1 resources=2 inventory=ipsec-interconnect.yaml
|
||||
# tftest modules=1 resources=2 inventory=ipsec-interconnect.yaml e2e
|
||||
```
|
||||
<!-- BEGIN TFDOC -->
|
||||
## Variables
|
||||
|
||||
| name | description | type | required | default |
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [project_id](variables.tf#L84) | Project where the addresses will be created. | <code>string</code> | ✓ | |
|
||||
| [project_id](variables.tf#L83) | Project where the addresses will be created. | <code>string</code> | ✓ | |
|
||||
| [external_addresses](variables.tf#L17) | Map of external addresses, keyed by name. | <code title="map(object({ region = string description = optional(string, "Terraform managed.") ipv6 = optional(object({ endpoint_type = string })) labels = optional(map(string), {}) name = optional(string) tier = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [global_addresses](variables.tf#L39) | List of global addresses to create. | <code title="map(object({ description = optional(string, "Terraform managed.") ipv6 = optional(map(string)) # To be left empty for ipv6 name = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [internal_addresses](variables.tf#L49) | Map of internal addresses to create, keyed by name. | <code title="map(object({ region = string subnetwork = string address = optional(string) description = optional(string, "Terraform managed.") ipv6 = optional(map(string)) # To be left empty for ipv6 labels = optional(map(string)) name = optional(string) purpose = optional(string) tier = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [ipsec_interconnect_addresses](variables.tf#L65) | Map of internal addresses used for HPA VPN over Cloud Interconnect. | <code title="map(object({ region = string address = string network = string description = optional(string, "Terraform managed.") name = optional(string) prefix_length = number }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [psa_addresses](variables.tf#L89) | Map of internal addresses used for Private Service Access. | <code title="map(object({ address = string network = string prefix_length = number description = optional(string, "Terraform managed.") name = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [psc_addresses](variables.tf#L102) | Map of internal addresses used for Private Service Connect. | <code title="map(object({ address = string network = string description = optional(string, "Terraform managed.") name = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [internal_addresses](variables.tf#L49) | Map of internal addresses to create, keyed by name. | <code title="map(object({ region = string subnetwork = string address = optional(string) description = optional(string, "Terraform managed.") ipv6 = optional(map(string)) # To be left empty for ipv6 labels = optional(map(string)) name = optional(string) purpose = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [ipsec_interconnect_addresses](variables.tf#L64) | Map of internal addresses used for HPA VPN over Cloud Interconnect. | <code title="map(object({ region = string address = string network = string description = optional(string, "Terraform managed.") name = optional(string) prefix_length = number }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [psa_addresses](variables.tf#L88) | Map of internal addresses used for Private Service Access. | <code title="map(object({ address = string network = string prefix_length = number description = optional(string, "Terraform managed.") name = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [psc_addresses](variables.tf#L101) | Map of internal addresses used for Private Service Connect. | <code title="map(object({ address = string network = string description = optional(string, "Terraform managed.") name = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
@ -161,4 +164,8 @@ module "addresses" {
|
|||
| [ipsec_interconnect_addresses](outputs.tf#L41) | Allocated internal addresses for HA VPN over Cloud Interconnect. | |
|
||||
| [psa_addresses](outputs.tf#L49) | Allocated internal addresses for PSA endpoints. | |
|
||||
| [psc_addresses](outputs.tf#L57) | Allocated internal addresses for PSC endpoints. | |
|
||||
|
||||
## Fixtures
|
||||
|
||||
- [net-vpc-ipv6.tf](../../tests/fixtures/net-vpc-ipv6.tf)
|
||||
<!-- END TFDOC -->
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
# Copyright 2024 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
module "vpc" {
|
||||
source = "./fabric/modules/net-vpc"
|
||||
project_id = var.project_id
|
||||
name = "fixture-net-vpc-external"
|
||||
ipv6_config = {
|
||||
enable_ula_internal = true
|
||||
}
|
||||
subnets = [
|
||||
{
|
||||
ip_cidr_range = "192.168.0.0/24"
|
||||
name = "ipv6-external"
|
||||
region = var.region
|
||||
ipv6 = {
|
||||
access_type = "EXTERNAL"
|
||||
}
|
||||
},
|
||||
{
|
||||
ip_cidr_range = "192.168.1.0/24"
|
||||
name = "ipv6-internal"
|
||||
region = var.region
|
||||
ipv6 = {
|
||||
access_type = "INTERNAL"
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
|
@ -23,7 +23,7 @@ values:
|
|||
region: europe-west8
|
||||
subnetwork: subnet_self_link
|
||||
module.addresses.google_compute_address.internal["ilb-2"]:
|
||||
address: 10.0.0.2
|
||||
address: 10.0.16.2
|
||||
address_type: INTERNAL
|
||||
labels: null
|
||||
name: ilb-2
|
||||
|
|
|
@ -29,7 +29,6 @@ values:
|
|||
project: project-id
|
||||
purpose: SHARED_LOADBALANCER_VIP
|
||||
region: europe-west8
|
||||
subnetwork: subnet_self_link
|
||||
module.addresses.google_compute_address.internal["vm"]:
|
||||
address_type: INTERNAL
|
||||
ip_version: IPV6
|
||||
|
@ -38,7 +37,6 @@ values:
|
|||
network: null
|
||||
project: project-id
|
||||
region: europe-west8
|
||||
subnetwork: subnet_self_link
|
||||
|
||||
counts:
|
||||
google_compute_address: 3
|
||||
|
|
Loading…
Reference in New Issue