|
| 1 | +variable "ibmcloud_api_key" { |
| 2 | + description = "The API key that's associated with the account to provision resources to" |
| 3 | + type = string |
| 4 | + sensitive = true |
| 5 | +} |
| 6 | + |
| 7 | +variable "resource_group" { |
| 8 | + type = string |
| 9 | + description = "The resource group name of the landing zone VPC." |
| 10 | +} |
| 11 | + |
| 12 | +variable "region" { |
| 13 | + description = "The region of the landing zone VPC." |
| 14 | + type = string |
| 15 | +} |
| 16 | + |
| 17 | +variable "prefix" { |
| 18 | + description = "The prefix to add to the VSI, block storage, security group, floating IP, and load balancer resources." |
| 19 | + type = string |
| 20 | + default = "slz-vsi" |
| 21 | +} |
| 22 | + |
| 23 | +variable "vpc_id" { |
| 24 | + description = "The ID of the VPC where the VSI will be created." |
| 25 | + type = string |
| 26 | +} |
| 27 | + |
| 28 | +variable "existing_ssh_key_name" { |
| 29 | + description = "The ID of the VPC where the VSI will be created." |
| 30 | + type = string |
| 31 | + default = null |
| 32 | +} |
| 33 | + |
| 34 | + |
| 35 | +variable "ssh_public_key" { |
| 36 | + description = "SSH keys to use to provision a VSI. Must be an RSA key with a key size of either 2048 bits or 4096 bits (recommended). If `public_key` is not provided, the named key will be looked up from data. See https://cloud.ibm.com/docs/vpc?topic=vpc-ssh-keys." |
| 37 | + type = string |
| 38 | + |
| 39 | + validation { |
| 40 | + error_message = "The public SSH key must be a valid SSH RSA public key." |
| 41 | + condition = var.ssh_public_key == null || can(regex("ssh-rsa AAAA[0-9A-Za-z+/]+[=]{0,3} ?([^@]+@[^@]+)?", var.ssh_public_key)) |
| 42 | + } |
| 43 | +} |
| 44 | + |
| 45 | +variable "resource_tags" { |
| 46 | + description = "A list of tags to add to the VSI, block storage, security group, floating IP, and load balancer created by the module." |
| 47 | + type = list(string) |
| 48 | + default = [] |
| 49 | +} |
| 50 | + |
| 51 | +variable "access_tags" { |
| 52 | + type = list(string) |
| 53 | + description = "A list of access tags to apply to the VSI resources created by the module." |
| 54 | + default = [] |
| 55 | +} |
| 56 | + |
| 57 | +variable "image_name" { |
| 58 | + description = "Image ID used for the VSI. Run the 'ibmcloud is images' CLI command to find available images. The IDs are different in each region." |
| 59 | + type = string |
| 60 | + default = "ibm-ubuntu-22-04-2-minimal-amd64-1" |
| 61 | +} |
| 62 | + |
| 63 | +variable "machine_type" { |
| 64 | + description = "VSI machine type" |
| 65 | + type = string |
| 66 | + default = "cx2-2x4" |
| 67 | +} |
| 68 | + |
| 69 | +variable "user_data" { |
| 70 | + description = "User data to initialize VSI deployment." |
| 71 | + type = string |
| 72 | + default = null |
| 73 | +} |
| 74 | + |
| 75 | +variable "boot_volume_encryption_key" { |
| 76 | + description = "The CRN of the boot volume encryption key." |
| 77 | + type = string |
| 78 | +} |
| 79 | + |
| 80 | +variable "existing_kms_instance_guid" { |
| 81 | + description = "The GUID of the KMS instance that holds the key specified in `var.boot_volume_encryption_key`." |
| 82 | + type = string |
| 83 | +} |
| 84 | + |
| 85 | +variable "skip_iam_authorization_policy" { |
| 86 | + type = bool |
| 87 | + description = "Set to `true` to skip the creation of an IAM authorization policy that permits all storage blocks to read the encryption key from the KMS instance. If set to `false` (and creating a policy), specify the GUID of the KMS instance in the `existing_kms_instance_guid` variable." |
| 88 | + default = false |
| 89 | +} |
| 90 | + |
| 91 | +variable "vsi_per_subnet" { |
| 92 | + description = "The number of VSI instances for each subnet." |
| 93 | + type = number |
| 94 | + default = 1 |
| 95 | +} |
| 96 | + |
| 97 | +variable "subnet_names" { |
| 98 | + description = "The subnets to deploy the VSI instances to." |
| 99 | + type = list(string) |
| 100 | + default = [ |
| 101 | + "vpe-zone-1", |
| 102 | + "vpe-zone-2", |
| 103 | + "vpe-zone-3" |
| 104 | + ] |
| 105 | +} |
| 106 | + |
| 107 | +variable "security_group_ids" { |
| 108 | + description = "IDs of additional security groups to add to the VSI deployment primary interface. A VSI interface can have a maximum of 5 security groups." |
| 109 | + type = list(string) |
| 110 | + default = [] |
| 111 | +} |
| 112 | + |
| 113 | +variable "block_storage_volumes" { |
| 114 | + description = "The list of block storage volumes to attach to each VSI." |
| 115 | + type = list( |
| 116 | + object({ |
| 117 | + name = string |
| 118 | + profile = string |
| 119 | + capacity = optional(number) |
| 120 | + iops = optional(number) |
| 121 | + encryption_key = optional(string) |
| 122 | + }) |
| 123 | + ) |
| 124 | + default = [] |
| 125 | +} |
| 126 | + |
| 127 | +variable "enable_floating_ip" { |
| 128 | + description = "Set to `true` to create a floating IP for each virtual server." |
| 129 | + type = bool |
| 130 | + default = false |
| 131 | +} |
| 132 | + |
| 133 | +variable "placement_group_id" { |
| 134 | + description = "Unique Identifier of the Placement Group for restricting the placement of the instance, default behaviour is placement on any host" |
| 135 | + type = string |
| 136 | + default = null |
| 137 | +} |
| 138 | + |
| 139 | +variable "load_balancers" { |
| 140 | + description = "The load balancers to add to the VSI." |
| 141 | + type = list( |
| 142 | + object({ |
| 143 | + name = string |
| 144 | + type = string |
| 145 | + listener_port = number |
| 146 | + listener_protocol = string |
| 147 | + connection_limit = number |
| 148 | + algorithm = string |
| 149 | + protocol = string |
| 150 | + health_delay = number |
| 151 | + health_retries = number |
| 152 | + health_timeout = number |
| 153 | + health_type = string |
| 154 | + pool_member_port = string |
| 155 | + security_group = optional( |
| 156 | + object({ |
| 157 | + name = string |
| 158 | + rules = list( |
| 159 | + object({ |
| 160 | + name = string |
| 161 | + direction = string |
| 162 | + source = string |
| 163 | + tcp = optional( |
| 164 | + object({ |
| 165 | + port_max = number |
| 166 | + port_min = number |
| 167 | + }) |
| 168 | + ) |
| 169 | + udp = optional( |
| 170 | + object({ |
| 171 | + port_max = number |
| 172 | + port_min = number |
| 173 | + }) |
| 174 | + ) |
| 175 | + icmp = optional( |
| 176 | + object({ |
| 177 | + type = number |
| 178 | + code = number |
| 179 | + }) |
| 180 | + ) |
| 181 | + }) |
| 182 | + ) |
| 183 | + }) |
| 184 | + ) |
| 185 | + }) |
| 186 | + ) |
| 187 | + default = [] |
| 188 | +} |
0 commit comments