Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPS-5596: Using Custom Private AMI #29

Merged
merged 9 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,35 +230,13 @@ Type: `string`

Default: `""`

### <a name="input_ami_name_filter"></a> [ami\_name\_filter](#input\_ami\_name\_filter)

Description: Name filter to help pick the AMI.

Type: `list(string)`

Default:

```json
[
"vault-consul-ubuntu18-*"
]
```

### <a name="input_ami_id"></a> [ami\_id](#input\_ami\_id)

Description: ID of the AMI to be used for the Consul and Vault instances.

Type: `string`

Default: `""`

### <a name="input_ami_owner"></a> [ami\_owner](#input\_ami\_owner)

Description: AWS account ID of the AMI owner. Defaults to HashiCorp.

Type: `string`

Default: `"562637147889"`
Default: `null`

<!-- TFDOCS_INPUTS_END -->

Expand Down
16 changes: 0 additions & 16 deletions data.tf
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
data "aws_region" "current" {}

data "aws_ami" "vault_consul" {
most_recent = true

owners = [var.ami_owner]

filter {
name = "virtualization-type"
values = ["hvm"]
}

filter {
name = "name"
values = var.ami_name_filter
}
}

data "aws_elb" "vault_elb" {
name = module.vault_elb.name
}
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module "vault_cluster" {
cluster_size = var.vault_cluster_size
instance_type = var.vault_instance_type

ami_id = var.ami_id != "" ? var.ami_id : data.aws_ami.vault_consul.image_id
ami_id = var.ami_id
user_data = templatefile("${path.module}/user-data/vault.sh.tftpl", {
enable_s3_backend = var.enable_s3_backend ? 1 : 0
s3_bucket_region = data.aws_region.current.name
Expand Down Expand Up @@ -81,7 +81,7 @@ module "consul_cluster" {
cluster_size = var.consul_cluster_size
instance_type = var.consul_instance_type

ami_id = var.ami_id != "" ? var.ami_id : data.aws_ami.vault_consul.image_id
ami_id = var.ami_id
user_data = templatefile("${path.module}/user-data/consul.sh.tftpl", {
consul_cluster_tag_key = local.consul_cluster_tag_key
consul_cluster_tag_value = local.consul_cluster_tag_val
Expand Down
14 changes: 1 addition & 13 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,8 @@ variable "kms_alias_name" {
type = string
}

variable "ami_name_filter" {
description = "Name filter to help pick the AMI."
default = ["vault-consul-ubuntu18-*"]
type = list(string)
}

variable "ami_id" {
description = "ID of the AMI to be used for the Consul and Vault instances."
type = string
default = ""
}

variable "ami_owner" {
description = "AWS account ID of the AMI owner. Defaults to HashiCorp."
default = "562637147889"
default = null
snovikov marked this conversation as resolved.
Show resolved Hide resolved
type = string
}
Loading