This repository has been archived by the owner on Sep 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created the vault-auth module and added the vault config in the ecs-w…
…eb module (#8) * Created the vault-auth module * Added the vault configuration in the ecs-web module * terraform fmt * Fix variable name * Fix tf syntax error * Fix vault auth role policy array * Fix vault auth output * Fix vault auth role bound parameter
- Loading branch information
1 parent
137ebce
commit ce087a1
Showing
10 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
resource "vault_aws_auth_backend_client" "concourse" { | ||
backend = "${var.vault_aws_auth_backend_path}" | ||
iam_server_id_header_value = "${replace(replace(var.vault_server_url, "/^http(s)?:///", ""), "/", "")}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
output "concourse_vault_policy_name" { | ||
value = "${vault_policy.concourse.name}" | ||
} | ||
|
||
output "concourse_vault_role_name" { | ||
value = "${vault_aws_auth_backend_role.concourse.role}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
resource "vault_policy" "concourse" { | ||
name = "concourse-${var.name_suffix}" | ||
|
||
policy = <<EOT | ||
path "concourse/*" { | ||
capabilities = ["read"] | ||
} | ||
EOT | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resource "vault_aws_auth_backend_role" "concourse" { | ||
backend = "${var.vault_aws_auth_backend_path}" | ||
role = "concourse-${var.name_suffix}" | ||
auth_type = "iam" | ||
bound_iam_principal_arn = "${var.concourse_iam_role_arn}" | ||
policies = ["${concat(list(vault_policy.concourse.name), var.additional_vault_policies)}"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
variable "name_suffix" { | ||
description = "Name suffix to append to the policy name, to differentiate different concourse policies. Defaults to 'default'" | ||
default = "default" | ||
} | ||
|
||
variable "additional_vault_policies" { | ||
description = "Additional Vault policies to attach to the Concourse role. Defaults to empty list" | ||
default = [] | ||
} | ||
|
||
variable "concourse_iam_role_arn" { | ||
description = "IAM role ARN of the Concourse ATC server" | ||
} | ||
|
||
variable "vault_aws_auth_backend_path" { | ||
description = "The path the AWS auth backend being configured was mounted at. Defaults to aws." | ||
default = "aws" | ||
} | ||
|
||
variable "vault_server_url" { | ||
description = "The Vault server url" | ||
} |