mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-18 12:37:02 +02:00
Begin the process of migrating away from the "strongly encouraged not to use"[0] Ec2 spot fleet API to the more modern `ec2:CreateFleet`. Unfortuantely the `instant` type fleet does not guarantee fulfillment with either on-demand or spot types. We'll need to add a feature similar to `wait_for_fulfillment` on the `spot_fleet_request` resource[1] to `ec2_fleet` before we can rely on it. We also update the existing target fleets to support provisioning generic targets. This has allowed us to remove our usage of `terraform-enos-aws-consul` and replace it with a smaller `backend_consul` module in-repo. We also remove `terraform-enos-aws-infra` and replace it with two smaller in-repo modules `ec2_info` and `create_vpc`. This has allowed us to simplify the vpc resources we use for each scneario, which in turn allows us to not rely on flaky resources. As part of this refactor we've also made it possible to provision targets using different distro versions. [0] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-best-practices.html#which-spot-request-method-to-use [1] https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/spot_fleet_request#wait_for_fulfillment * enos/consul: add `backend_consul` module that accepts target hosts. * enos/target_ec2_spot_fleet: add support for consul networking. * enos/target_ec2_spot_fleet: add support for customizing cluster tag key. * enos/scenarios: create `target_ec2_fleet` which uses a more modern `ec2_fleet` API. * enos/create_vpc: replace `terraform-enos-aws-infra` with smaller and simplified version. Flatten the networking to a single route on the default route table and a single subnet. * enos/ec2_info: add a new module to give us useful ec2 information including AMI id's for various arch/distro/version combinations. * enos/ci: update service user role to allow for managing ec2 fleets. Signed-off-by: Ryan Cragun <me@ryan.ec>
88 lines
2.3 KiB
HCL
88 lines
2.3 KiB
HCL
variable "ami_id" {
|
|
description = "The machine image identifier"
|
|
type = string
|
|
}
|
|
|
|
variable "awskms_unseal_key_arn" {
|
|
type = string
|
|
description = "The AWSKMS key ARN if using the awskms unseal method. If specified the instances will be granted kms permissions to the key"
|
|
default = null
|
|
}
|
|
|
|
variable "cluster_name" {
|
|
type = string
|
|
description = "A unique cluster identifier"
|
|
default = null
|
|
}
|
|
|
|
variable "cluster_tag_key" {
|
|
type = string
|
|
description = "The key name for the cluster tag"
|
|
default = "TargetCluster"
|
|
}
|
|
|
|
variable "common_tags" {
|
|
description = "Common tags for cloud resources"
|
|
type = map(string)
|
|
default = {
|
|
Project = "Vault"
|
|
}
|
|
}
|
|
|
|
variable "instance_mem_min" {
|
|
description = "The minimum amount of memory in mebibytes for each instance in the fleet. (1 MiB = 1024 bytes)"
|
|
type = number
|
|
default = 4096 // ~4 GB
|
|
}
|
|
|
|
variable "instance_mem_max" {
|
|
description = "The maximum amount of memory in mebibytes for each instance in the fleet. (1 MiB = 1024 bytes)"
|
|
type = number
|
|
default = 16385 // ~16 GB
|
|
}
|
|
|
|
variable "instance_cpu_min" {
|
|
description = "The minimum number of vCPU's for each instance in the fleet"
|
|
type = number
|
|
default = 2
|
|
}
|
|
|
|
variable "instance_cpu_max" {
|
|
description = "The maximum number of vCPU's for each instance in the fleet"
|
|
type = number
|
|
default = 8 // Unlikely we'll ever get that high due to spot price bid protection
|
|
}
|
|
|
|
variable "instance_count" {
|
|
description = "The number of target instances to create"
|
|
type = number
|
|
default = 3
|
|
}
|
|
|
|
variable "project_name" {
|
|
description = "A unique project name"
|
|
type = string
|
|
}
|
|
|
|
variable "max_price" {
|
|
description = "The maximum hourly price to pay for each target instance"
|
|
type = string
|
|
default = "0.0416"
|
|
}
|
|
|
|
variable "ssh_allow_ips" {
|
|
description = "Allowlisted IP addresses for SSH access to target nodes. The IP address of the machine running Enos will automatically allowlisted"
|
|
type = list(string)
|
|
default = []
|
|
}
|
|
|
|
variable "ssh_keypair" {
|
|
description = "SSH keypair used to connect to EC2 instances"
|
|
type = string
|
|
}
|
|
|
|
variable "vpc_id" {
|
|
description = "The identifier of the VPC where the target instances will be created"
|
|
type = string
|
|
}
|