aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform/1n_nmd/vault-aws-secret-backend/main.tf
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2021-10-29 06:19:46 +0000
committerpmikus <pmikus@cisco.com>2021-10-29 06:19:46 +0000
commit5747228f8c7c793dcf62a94aeb11fdb96ee7a37e (patch)
tree73f06cc812604071f6d8517382b0c5ffa027da1b /fdio.infra.terraform/1n_nmd/vault-aws-secret-backend/main.tf
parent585b9d8bbf21b0c5a2d2c28809688563007760db (diff)
feat(Terraform): AWS backend role migration
Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: I8c93eaaa766c48b705a19e38123b69c994669dc0
Diffstat (limited to 'fdio.infra.terraform/1n_nmd/vault-aws-secret-backend/main.tf')
-rw-r--r--fdio.infra.terraform/1n_nmd/vault-aws-secret-backend/main.tf37
1 files changed, 37 insertions, 0 deletions
diff --git a/fdio.infra.terraform/1n_nmd/vault-aws-secret-backend/main.tf b/fdio.infra.terraform/1n_nmd/vault-aws-secret-backend/main.tf
new file mode 100644
index 0000000000..a65c390792
--- /dev/null
+++ b/fdio.infra.terraform/1n_nmd/vault-aws-secret-backend/main.tf
@@ -0,0 +1,37 @@
+resource "vault_aws_secret_backend" "aws" {
+ access_key = var.aws_access_key
+ secret_key = var.aws_secret_key
+ path = "${var.name}-path"
+
+ default_lease_ttl_seconds = "0"
+ max_lease_ttl_seconds = "0"
+}
+
+resource "vault_aws_secret_backend_role" "admin" {
+ backend = vault_aws_secret_backend.aws.path
+ name = "${var.name}-role"
+ credential_type = "iam_user"
+
+ policy_document = <<EOF
+{
+ "Version": "2012-10-17",
+ "Statement": [
+ {
+ "Effect": "Allow",
+ "Action": [
+ "iam:*", "ec2:*"
+ ],
+ "Resource": "*"
+ }
+ ]
+}
+EOF
+}
+
+output "backend" {
+ value = vault_aws_secret_backend.aws.path
+}
+
+output "role" {
+ value = vault_aws_secret_backend_role.admin.name
+}