From fae5069ae5770583958d0b45732741896e9a5dc4 Mon Sep 17 00:00:00 2001 From: Vallat Date: Fri, 6 Dec 2024 16:23:32 +0100 Subject: [PATCH] IAM --- terraform/environments/dev/main.tf | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/terraform/environments/dev/main.tf b/terraform/environments/dev/main.tf index 7476070..fcdf92e 100644 --- a/terraform/environments/dev/main.tf +++ b/terraform/environments/dev/main.tf @@ -41,10 +41,23 @@ module "compute" { module "iam" { - source = "../../modules/iam" - - # Variables d'entrée - - # Autres variables spécifiques au module + source = "../../modules/iam" project_id = var.project_id } + +data "google_client_openid_userinfo" "me" { +} + +resource "local_file" "ansible_config" { + content = templatefile("${path.module}/../../templates/ansible.cfg.tpl", + { + remote_user = data.google_client_openid_userinfo.me.email + } + ) + filename = "../../../ansible/ansible.cfg" +} + +resource "local_file" "service_account" { + content = base64decode(module.iam.service_account_key) + filename = "../../../ansible/service_account.json" +}