Terraform validation reference
For custom outposts with custom networking (BYON) deployed with Terraform: look up the plan-time checks that the Terraform module enforces, and the meaning of each validation error.
The Terraform module enforces the checks below at plan time. They fail fast with a clear error before any resource is created, so you can fix your inputs before deploying. Use this reference to prevent errors before you run terraform apply, and to look up the exact meaning of a plan-time error when it appears. Rules that apply on every cloud are in the shared section; rules that apply only to one cloud are in that cloud's section.
Shared rules (all clouds)
The rules below apply on every cloud. All are enforced at plan time.
Proxy requires BYON
proxy_config.enabled can only be true when a BYON configuration is set.
Proxy auth requires BYON
proxy_config.auth_enabled can only be true in BYON mode.
Proxy host required
proxy_config.host must be non-empty when enabled = true.
Proxy port range
proxy_config.port must be between 1 and 65535.
Proxy auth needs both credentials
When auth_enabled = true, both proxy_username and proxy_password must be provided (via -var).
TLS inspection needs a CA
When tls_enabled = true, ca_cert_content must be non-empty.
CA cert format
ca_cert_content must be base64-encoded PEM, with no headers or newlines. Generate it with cat ca.pem
Proxy credentials character set
proxy_username and proxy_password must be printable, non-whitespace characters.
Supported regions
Every region key in the BYON configuration must be a supported region for that cloud.
Virtual network / VPC region mapping
The actual cloud region where the virtual network (or VPC) physically resides must exactly match the region key as it is configured in the BYON configuration (byon_config block).
AWS rules
The rules below apply to AWS BYON configurations. All are enforced at plan time.
Supported AWS region
Each region key must be a supported AWS region.
Each region key in byon_config must be a supported AWS region.
Region available in account
Each region must be available and enabled in the account.
Each region key in byon_config must be a supported AWS region available in this account.
At least one AZ subnet
Each region must have at least one zone with a subnet ID.
Each region in byon_config must have at least 1 zone with a subnet ID.
Subnet inside VPC
Every subnet ID must belong to the VPC ID in the same region.
All subnet_ids must belong to the specified vpc_id (<vpc_id>). One or more subnets belong to a different VPC.
Proxy address is an IPv4 address
When Outbound proxy is on, the host in the proxy address must be an IPv4 address. An http:// or https:// scheme is allowed. Hostnames and IPv6 addresses are not supported.
When proxy_enabled is true in BYON mode, proxy_host must resolve to a literal IPv4 address for the scanner SG egress CIDR ...
Azure rules
The rules below apply to Azure BYON configurations. All are enforced at plan time. The virtual-network and subnet existence checks, and the service-endpoint check, read your live network at plan time, so the subnet must already exist when you run terraform plan or terraform apply.
VNet ID format
virtual_network_id must be a full VNet ARM resource ID.
must be a full Azure VNet ARM resource ID of the form ...
Subnet ID format
subnet_id must be a full Subnet ARM resource ID.
must be a full Azure Subnet ARM resource ID of the form ...
Subnet inside VNet (ID)
subnet_id must start with <virtual_network_id>/subnets/.
must belong to the same VNet as ... (subnet ID must start with ...)
Subnet inside VNet (live)
The subnet's actual VNet must equal virtual_network_id. Catches a typo that still passes the regex.
customer_subnet_id (...) belongs to VNet 'X', but customer_virtual_network_id points to VNet 'Y'. Both must reference the same VNet.
Service endpoints present
The subnet must carry Microsoft.Storage and Microsoft.KeyVault.
subnet '...' missing required service endpoints (need Microsoft.Storage and Microsoft.KeyVault). Found: [...]
Regions match enabled locations
keys(byon_config) must exactly equal enabled_locations.
keys(byon_config) must exactly equal enabled_locations. Got byon_config=... vs enabled_locations=...
Supported Azure location
Each region key must be a supported Azure location.
Each region key in byon_config must be a supported Azure location.
VNet region mapping
The actual Azure region where the virtual network (VNet) physically resides must exactly match the region key as it is configured in the BYON configuration (byon_config block).
customer_virtual_network_id resides in Azure region 'X', but it is configured under byon_config key 'Y'.
GCP rules
The rules below apply to GCP BYON configurations. All are enforced at plan time.
At least one subnet
byon_config.subnets must contain at least one region.
byon_config.subnets must contain at least one region when byon_config is provided.
VPC not empty
byon_config.compute_vpc_id must not be empty.
byon_config.compute_vpc_id must not be empty when byon_config is provided.
Subnet IDs not empty
Each subnets[].compute_subnet_id must be non-empty.
Each byon_config.subnets[].compute_subnet_id must not be empty.
Supported GCP region
Each region key must be a supported GCP region.
Each region key in byon_config.subnets must be a supported GCP region.
Subnetwork ID format
Each compute_subnet_id must be a fully qualified regional subnetwork path in the exact format: projects/<p>/regions/<r>/subnetworks/<s>
Invalid value for field 'resource.networkInterfaces[0].subnetwork': '<value>'. The URL is malformed.
Subnetwork region mapping
The region (<r>) in the subnetwork path must exactly match the region key as it is configured in the BYON configuration (byon_config.subnets block).
Instance must be in the same region as the subnetwork.
Subnetwork VPC association
Every provided subnetwork must actually belong to the Virtual Private Cloud (VPC) network defined by compute_vpc_id.
Invalid value for field 'resource.subnetwork': '<value>'. Subnetwork does not belong to network.
Last updated
Was this helpful?
