Formation DevOps | Formation Terraform : 24- Premier pas avec Terraform :docker +modules

www.itgalaxy.io

1.Rassembler les instructions précédentes dans un module

2.Création du module: run docker nginx
terraform {
required_providers {
docker = {
source = “kreuzwerker/docker”
version = “2.15.0”
}
}
}
provider “docker” {
host = “tcp://${var.ssh_host}:2375”
}
resource “docker_image” “nginx” {
name = “nginx:latest”
}
resource “docker_container” “nginx” {
image = docker_image.nginx.latest
name = “enginecks”
ports {
internal = 80
external = 80
}
}

variable “ssh_host” {}

variable.tf

2.Utilisation des modules

Avant le lancement

variable “ssh_host” {}
variable “ssh_user” {}
variable “ssh_key” {}
module “install” {
source = “./modules/docker_install”
ssh_host = var.ssh_host
ssh_key = var.ssh_key
ssh_user = var.ssh_user
}

module “docker_run_ngnix” {
source = “./modules/docker_run_ngnix”
ssh_host = var.ssh_host
}

terraform apply -target module.install






1. Nous contactez


2. Infra as a Service

  • Description: Infrastructure cloud évolutive et sécurisée
  • Links:

3. Projets Développeurs


4. Développeurs


5. Formations Complètes


6. Marketplace

7. Blogs


This website is powered by ItGalaxy.io