Use proxmox_ssh_private_key variable when available, otherwise fall back to SSH agent for local development.
51 lines
1.6 KiB
HCL
51 lines
1.6 KiB
HCL
# ==========================================================================
|
|
# Déclaration des Providers Terraform
|
|
#
|
|
# Ce fichier indique à Terraform quels "plugins" il doit
|
|
# télécharger pour interagir avec les API externes (Proxmox, etc.)
|
|
# et comment les configurer.
|
|
# ==========================================================================
|
|
|
|
terraform {
|
|
required_version = ">= 1.5.0"
|
|
# ---------------------------------------------------------------------------
|
|
# Backend S3 - Stockage distant du state Terraform
|
|
#
|
|
# Utilise Scaleway Object Storage (compatible S3) pour stocker
|
|
# le fichier terraform.tfstate de manière centralisée et sécurisée.
|
|
#
|
|
# Variables d'environnement requises :
|
|
# - AWS_ACCESS_KEY_ID : Clé d'accès Scaleway
|
|
# - AWS_SECRET_ACCESS_KEY : Clé secrète Scaleway
|
|
# ---------------------------------------------------------------------------
|
|
backend "s3" {
|
|
bucket = "netlab-terraform-backend"
|
|
key = "prod/terraform.tfstate"
|
|
region = "fr-par"
|
|
endpoint = "https://s3.fr-par.scw.cloud"
|
|
|
|
# Paramètres requis pour Scaleway (non-AWS S3)
|
|
skip_credentials_validation = true
|
|
skip_region_validation = true
|
|
skip_metadata_api_check = true
|
|
}
|
|
|
|
required_providers {
|
|
proxmox = {
|
|
source = "bpg/proxmox"
|
|
version = "0.89.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
provider "proxmox" {
|
|
endpoint = var.proxmox_url
|
|
api_token = var.proxmox_api_token
|
|
insecure = true
|
|
ssh {
|
|
agent = var.proxmox_ssh_private_key == "" ? true : false
|
|
username = "root"
|
|
private_key = var.proxmox_ssh_private_key != "" ? var.proxmox_ssh_private_key : null
|
|
}
|
|
}
|