fix: Configure SSH keys for CI/CD pipeline #11
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problème
Le pipeline CI/CD Terraform échoue car :
Clé SSH publique : La fonction
file(var.admin_ssh_public_key_path)ne fonctionne pas dans le container CI car le chemin~/.ssh/keys/id_rsa.pubn'existe pas.Provider bpg/proxmox SSH : Le provider est configuré avec
ssh { agent = true }mais il n'y a pas d'agent SSH dans le container CI.Solution
Nouveaux secrets à créer
SSH_PUBLIC_KEYSSH_PRIVATE_KEYModifications Terraform
1.
terraform/prod/variables.tfRemplacer la variable path par une variable contenant directement la clé :
2.
terraform/prod/02-cloud-init.tfUtiliser directement la variable :
3.
terraform/prod/providers.tfConfigurer SSH avec clé privée au lieu de l'agent :
Et ajouter la variable dans
variables.tf:Modifications Workflows
4.
.gitea/workflows/terraform-deploy.ymletterraform-pr.ymlAjouter les nouvelles variables d'environnement :
Checklist
SSH_PUBLIC_KEYdans GiteaSSH_PRIVATE_KEYdans Giteaterraform/prod/variables.tfterraform/prod/02-cloud-init.tfterraform/prod/providers.tf.gitea/workflows/terraform-deploy.yml.gitea/workflows/terraform-pr.ymlNotes de sécurité
sensitive = truedans TerraformRéférences