Skip to content

Commit

Permalink
Merge pull request #29 from Flaconi/OPS-5596-updating-vault-module
Browse files Browse the repository at this point in the history
OPS-5596: Using Custom Private AMI
  • Loading branch information
vikkasyousaf authored Sep 25, 2023
2 parents 099a293 + e103a25 commit 1b72644
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 54 deletions.
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
type = string
}

0 comments on commit 1b72644

Please sign in to comment.