variables.tf 1.2 KB

1234567891011121314151617181920212223242526272829
  1. variable "layer" {
  2. type = string
  3. description = "Stack layer, used in names (for example foundation)."
  4. }
  5. variable "region" {
  6. type = string
  7. description = "AWS region name (for example us-east-1). Used in names; the stack's provider block decides where the VPC is really created."
  8. }
  9. variable "ip_range" {
  10. type = string
  11. description = "Private IPv4 CIDR for the VPC. The one public subnet uses the whole range."
  12. validation {
  13. condition = (
  14. can(cidrnetmask(var.ip_range)) &&
  15. can(regex("^(10\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.|192\\.168\\.)", var.ip_range)) &&
  16. can(regex("/(1[6-9]|2[0-8])$", var.ip_range)) &&
  17. try(var.ip_range == cidrsubnet(var.ip_range, 0, 0), false)
  18. )
  19. error_message = "ip_range must be a private IPv4 CIDR (10/8, 172.16/12 or 192.168/16) with a prefix length from /16 to /28, written as its network address (10.0.0.0/24, not 10.0.0.1/24): AWS rejects anything else."
  20. }
  21. }
  22. variable "availability_zone" {
  23. type = string
  24. default = null
  25. description = "Availability zone of the subnet (for example us-east-1a). Null lets AWS choose. AWS extension: a subnet lives in exactly one zone."
  26. }