Skip to content

Instantly share code, notes, and snippets.

@fedir

fedir/main.tf

Created Dec 23, 2020
Embed
What would you like to do?
Local Docker provisioning with Terraform sample
# Local Docker provisionning
terraform {
required_providers {
docker = {
source = "terraform-providers/docker"
}
}
}
provider "docker" {}
# Nginx
resource "docker_image" "nginx" {
name = "nginx:latest"
keep_locally = false
}
resource "docker_container" "nginx" {
image = docker_image.nginx.latest
name = "tutorial"
ports {
internal = 80
external = 8000
}
}
# Nexus
resource "docker_image" "nexus" {
name = "sonatype/nexus3:latest"
keep_locally = false
}
resource "docker_container" "nexus" {
image = docker_image.nexus.latest
name = "nexus"
ports {
internal = 8081
external = 8081
}
}
# Sonraqube
resource "docker_image" "sonarqube" {
name = "sonarqube:latest"
keep_locally = false
}
resource "docker_container" "sonarqube" {
image = docker_image.sonarqube.latest
name = "sonarqube"
ports {
internal = 9000
external = 9000
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment