Skip to content

Commit

Permalink
Merge pull request #9 from companieshouse/feature/logging
Browse files Browse the repository at this point in the history
Incorporate Vault authentication methods
  • Loading branch information
marcransome authored Apr 12, 2021
2 parents c7967fe + 68ac45d commit 97fef30
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 9 deletions.
4 changes: 2 additions & 2 deletions groups/frontend/instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ resource "aws_security_group" "common" {
vpc_id = data.aws_vpc.heritage.id

ingress {
description = "Allow SSH connectivity from trusted subnets"
description = "Allow SSH connectivity for application deployments"
from_port = 22
to_port = 22
protocol = "TCP"
cidr_blocks = var.ssh_cidrs
cidr_blocks = var.deployment_cidrs
}

egress {
Expand Down
12 changes: 5 additions & 7 deletions groups/frontend/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ variable "default_log_retention_in_days" {
default = 7
}

variable "deployment_cidrs" {
type = list(string)
description = "A list of strings representing CIDR ranges from which applications will be deployed to Tuxedo instances via Ansible"
}

variable "web_subnet_pattern" {
type = string
description = "The pattern to use when filtering for web subnets by 'Name' tag"
Expand Down Expand Up @@ -173,13 +178,6 @@ variable "tuxedo_services" {
},
}
}

# TODO read from Vault
variable "ssh_cidrs" {
type = list(string)
description = "A list of strings representing CIDR ranges from which SSH connections are permitted to EC2 instances"
}

variable "ssh_master_public_key" {
type = string
description = "The SSH master public key; EC2 instance connect should be used for regular connectivity"
Expand Down
20 changes: 20 additions & 0 deletions groups/frontend/vault-providers/approle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
variable "hashicorp_vault_role_id" {
description = "The role identifier used when retrieving configuration from Hashicorp Vault"
type = string
}

variable "hashicorp_vault_secret_id" {
description = "The secret identifier used when retrieving configuration from Hashicorp Vault"
type = string
}

provider "vault" {
auth_login {
path = "auth/approle/login"

parameters = {
role_id = var.hashicorp_vault_role_id
secret_id = var.hashicorp_vault_secret_id
}
}
}
5 changes: 5 additions & 0 deletions groups/frontend/vault-providers/token
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
provider "vault" {
# Credentials read from the environment variables:
# ${VAULT_ADDR}
# ${VAULT_TOKEN}
}
19 changes: 19 additions & 0 deletions groups/frontend/vault-providers/userpass
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
variable "hashicorp_vault_username" {
description = "The username used when retrieving configuration from Hashicorp Vault"
type = string
}

variable "hashicorp_vault_password" {
description = "The password used when retrieving configuration from Hashicorp Vault"
type = string
}

provider "vault" {
auth_login {
path = "auth/userpass/login/${var.hashicorp_vault_username}"

parameters = {
password = var.hashicorp_vault_password
}
}
}
1 change: 1 addition & 0 deletions groups/frontend/vault.tf

0 comments on commit 97fef30

Please sign in to comment.