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" +}