gestion_configuration:terraform:toc
Ceci est une ancienne révision du document !
Table des matières
Terraform Examples
provider "aws" { #Virginia, USA region = "us-east-1" } resource "aws_instance" "example" { #Ubuntu 14.04 AMI (Amazon Machine Image) ami = "ami-2d39803a" instance_type = "t2.micro" tags { #tags WILL CHANGE the state of previous runnings resources. Name = "My Instance Name" } }
Configuration
Backend
Créer un fichier dans le home directory nommé .terraformrc
:
credentials "app.terraform.io" { token = "xxxxxx.atlasv1.zzzzzzzzzzzzz" }
Dans le répertoire de travail de Terraform, créer un fichier de configuration backend.hcl
.
workspaces { name = "workspace" } hostname = "app.terraform.io" organization = "company"
Sources : CLI Configuration File et Backend - Remote.
Provisioner
File
provisioner "file" { connection { type = "ssh" user = "root" private_key = "${var.private_key}" host = "${var.hostname}" } source = "/local/path/to/file.txt" destination = "/path/to/file.txt" }
Remote
provisioner "remote-exec" { inline = [ "puppet apply", "consul join ${aws_instance.web.private_ip}", ] }
gestion_configuration/terraform/toc.1570840504.txt.gz · Dernière modification : 2022/02/02 00:43 (modification externe)