Terraform Provider - Docker
Find a file
Shunsuke Suzuki 3f9193463f
docs: add an example to build an image with docker_image (#158)
* docs: add an example to build a Docker image with docker_image
* docs: add description of the docker_image.build block
2021-03-29 10:09:08 +02:00
.github feat: support darwin arm builds and golang 1.16 (#140) 2021-03-18 23:21:49 +09:00
examples/ssh-protocol Add ssh protocol (copy) (#153). Closes #112 2019-05-26 21:06:10 +02:00
internal/provider feat: migrate to terraform-sdk v2 (#102) 2021-03-18 08:30:54 +01:00
scripts feat: support darwin arm builds and golang 1.16 (#140) 2021-03-18 23:21:49 +09:00
tools feat: add ability to lint/check of links in documentation locally (#98) 2020-12-27 19:02:34 +09:00
website docs: add an example to build an image with docker_image (#158) 2021-03-29 10:09:08 +02:00
.gitignore chore: ignores testing folders 2020-12-24 16:26:29 +01:00
.go-version feat: support darwin arm builds and golang 1.16 (#140) 2021-03-18 23:21:49 +09:00
.golangci.yml feat: migrate to terraform-sdk v2 (#102) 2021-03-18 08:30:54 +01:00
.goreleaser.yml ci(goreleaser): switches from free to openbsd 2020-11-11 09:34:41 +01:00
.markdownlinkcheck.json ci: fix test of website 2020-12-12 01:21:02 +09:00
.markdownlint.yml ci: fix test of website 2020-12-12 01:21:02 +09:00
CHANGELOG.md chore: update changelog for v2.11.0 2021-01-22 21:10:38 +01:00
CODE_OF_CONDUCT.md docs: adds coc and contributing 2020-12-24 16:27:35 +01:00
CONTRIBUTING.md docs: add a guide about writing issues to CONTRIBUTING.md (#149) 2021-03-24 16:25:35 +01:00
GNUmakefile feat: support darwin arm builds and golang 1.16 (#140) 2021-03-18 23:21:49 +09:00
go.mod feat: support darwin arm builds and golang 1.16 (#140) 2021-03-18 23:21:49 +09:00
go.sum feat: migrate to terraform-sdk v2 (#102) 2021-03-18 08:30:54 +01:00
LICENSE initial commit 2017-06-05 20:59:08 +00:00
main.go feat: migrate to terraform-sdk v2 (#102) 2021-03-18 08:30:54 +01:00
README.md docs(readme): update example usage 2021-03-25 11:50:57 +01:00

Terraform Provider

Requirements

  • Terraform >=0.12.x
  • Go 1.15.x (to build the provider plugin)

Building The Provider

$ git clone git@github.com:kreuzwerker/terraform-provider-docker
$ make build

Example usage

# Set the required provider and versions
terraform {
  required_providers {
    # We recommend pinning to the specific version of the Docker Provider you're using
    # since new versions are released frequently
    docker = {
      source  = "kreuzwerker/docker"
      version = "2.11.0"
    }
  }
}

# Configure the docker provider
provider "docker" {
}

# Create a docker image resource
# -> docker pull nginx:latest
resource "docker_image" "nginx" {
  name         = "nginx:latest"
  keep_locally = true
}

# Create a docker container resource
# -> same as 'docker run --name nginx -d nginx:latest'
resource "docker_container" "nginx" {
  name    = "nginx"
  image   = docker_image.nginx.latest
}