Skip to content
Snippets Groups Projects
Commit c1b7ffed authored by Mickael Masquelin's avatar Mickael Masquelin
Browse files

Merge avec contenus de la branche 'terraform'

parents a0af95ee d0c2b8ea
No related branches found
No related tags found
No related merge requests found
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### Packer ###
# Cache objects
packer_cache/
# Crash log
crash.log
# https://www.packer.io/guides/hcl/variables
# Exclude all .pkrvars.hcl files, which are likely to contain sensitive data,
# such as password, private keys, and other secrets. These should not be part of
# version control as they are data points which are potentially sensitive and
# subject to change depending on the environment.
#
*.pkrvars.hcl
# For built boxes
*.box
### Packer Patch ###
# ignore temporary output files
output-*/
### Terraform ###
# Local .terraform directories
**/.terraform/*
# .tfstate files
*.tfstate
*.tfstate.*
# Crash log files
crash.*.log
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json
# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json
# Include override files you do wish to add to version control using negated pattern
# !example_override.tf
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
# Ignore CLI configuration files
.terraformrc
terraform.rc
.terraform.lock.hcl
formation-cnrs-docker
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "3.0.2"
}
}
}
variable "docker_api_path" {
type = string
description = "Chemin d'accès à l'API (via tcp ou unix)"
}
provider "docker" {
# Pour un hôte linux, déclaration de l'hôte :
# "unix:///var/run/docker.sock"
# Adaptation pour macOS :
# "unix:///$HOME/.docker/run/docker.sock"
host = var.docker_api_path
}
resource "docker_container" "terraform_container" {
image = "local/ubu-form-cnrs-nginx:22.04.2"
name = "nginx_via_terraform"
ports {
internal = "80"
external = "5555"
}
}
\ No newline at end of file
File added
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "3.0.2"
}
}
}
variable "docker_api_path" {
type = string
description = "Chemin d'accès à l'API (via tcp ou unix)"
}
provider "docker" {
host = var.docker_api_path
}
resource "docker_network" "private_network" {
name = "wpnet_form_docker"
}
resource "docker_volume" "wpdb_form_docker" {
name = "wpdb_form_docker"
}
resource "docker_volume" "wphtml_form_docker" {
name = "wphtml_form_docker"
}
resource "docker_container" "db_form_docker" {
name = "db"
image = "mariadb:latest"
restart = "always"
network_mode = "wpnet_form_docker"
mounts {
type = "volume"
target = "/var/lib/mysql"
source = "wpdb_form_docker"
}
env = [
"MYSQL_ROOT_PASSWORD=mdprootmysql",
"MYSQL_DATABASE=wordpress",
"MYSQL_USER=wpuser",
"MYSQL_PASSWORD=wppassword"
]
}
resource "docker_container" "wordpress_form_docker" {
name = "wordpress"
image = "wordpress:latest"
restart = "always"
network_mode = "wpnet_form_docker"
env = [
"WORDPRESS_DB_HOST=db",
"WORDPRESS_DB_USER=wpuser",
"WORDPRESS_DB_PASSWORD=wppassword",
"WORDPRESS_DB_NAME=wordpress"
]
ports {
internal = "80"
external = "5555"
}
mounts {
type = "volume"
target = "/var/www/html"
source = "wphtml_form_docker"
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment