Terraform Provider - Docker
Find a file
Manuel Vogel 0588c2071b
chore/refactor tests (#201)
* chore: format test configs for datasources

* chore: outlines load test config helper and structure

* docs(contributing): add command for resouce tests

to have an example of the regex

* refactor: move container test configs into separate files

* fix: add insecure_skip_verify for image pulls

to fix the local test setup with invalid certs

* chore(ci): remove insecure registry adaption

* chore: regenerate website

* chore: update gitignore for scipts/testing dir

* fix: replace nodejs services with go versions

* fix: move testing program versions in separate files

* test: reactivate flaky test from travis

* chore: fix linter on all go files

* fix(linter): testing go servers

* chore(ci): add env for go version

* chore(ci): name workflow steps

also moves description of available docker versions in to acc dockerfile

* Revert "test: reactivate flaky test from travis"

This reverts commit b02654acc4d6b7d02c8f3ba090e6a3f248741b10.

* docs: fix provider-ssh example

* chore: use alpine als final image for tests

* refactor: move test configs from folder into testname.tf files

* refactor: image delete log is now debug and indented

* refactor: image test config into seprate files

* refactor: move network test config into seperate files

* refactor: move plugin test config into seperate files

* chore: rename registry image test file

* refactor: move registry_image test config into seperate files

* chore: format secret test configs

* refactor: inline volume test configs

* fix: remove unused volume label test function

* refactor: move service test configs into seperate files

* test: reactivate and fix service test

* chore: simplify insecure skip verify add to http client

* chore(ci): debug into service test

* chore(ci): add testacc setup

* chore: format tf config for provider test

* chore(ci): add debug output for config.json

* fix: check service auth for emptyness

* fix: remove re-read of provider auth config

because the bug occured only in CI as the meta object might be GCd

* test: pass auth to service instead of provider

* chore: reactivate all acc tests

* test: outlines service inspect json check for full spec

* test: add service inspect json checks

* test: finish service inspect json checks

* chore(service): move test helper to end to of the file

* chore: move mapEquals to test helpers

* test: add json inspect for config

* chore: add debug inspect log for plugin, secret and volume

* test: add json inspect for secret

* test: add json inspect for image

* test: add json inspect for network

* test: add json inspect for plugin

* test: add json inspect for volume

* test: inline ds plugin test configs

* test: inline network configs

* test: move ds reg image configs into separate files

* test: reactivates container upload checks

* chore: adapt issues ref from old to new xw repo

* fix: reactivate network ingress test

and provide helpers for removing the default ingress network and leaving the swamr

* docs: rerun website gen

* test: fix reg image build and keep test

* chore: add name to todo

* chore: move ds network and plugin specs to file

* chore: format provider test spec

* chore: use simpler error message for empty strings
2021-05-31 16:11:49 +09:00
.github chore/refactor tests (#201) 2021-05-31 16:11:49 +09:00
docs chore/refactor tests (#201) 2021-05-31 16:11:49 +09:00
examples chore/refactor tests (#201) 2021-05-31 16:11:49 +09:00
internal/provider chore/refactor tests (#201) 2021-05-31 16:11:49 +09:00
scripts chore/refactor tests (#201) 2021-05-31 16:11:49 +09:00
templates feat/doc generation (#193) 2021-05-21 21:30:56 +09:00
testdata chore/refactor tests (#201) 2021-05-31 16:11:49 +09:00
tools feat/doc generation (#193) 2021-05-21 21:30:56 +09:00
.gitignore chore/refactor tests (#201) 2021-05-31 16:11:49 +09: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 fix(deps): update module github.com/golangci/golangci-lint to v1.39.0 (#166) 2021-04-09 11:56:56 +02:00
.markdownlinkcheck.json feat/doc generation (#193) 2021-05-21 21:30:56 +09:00
.markdownlint.yml feat/doc generation (#193) 2021-05-21 21:30:56 +09:00
CHANGELOG.md chore: prepare release v2.12.2 2021-05-26 09:05:51 +02:00
CODE_OF_CONDUCT.md docs: adds coc and contributing 2020-12-24 16:27:35 +01:00
CONTRIBUTING.md chore/refactor tests (#201) 2021-05-31 16:11:49 +09:00
GNUmakefile chore/refactor tests (#201) 2021-05-31 16:11:49 +09:00
go.mod feat/doc generation (#193) 2021-05-21 21:30:56 +09:00
go.sum feat/doc generation (#193) 2021-05-21 21:30:56 +09:00
LICENSE initial commit 2017-06-05 20:59:08 +00:00
main.go feat/doc generation (#193) 2021-05-21 21:30:56 +09:00
README.md chore: prepare release v2.12.2 2021-05-26 09:05:51 +02:00
renovate.json5 chore(renovate): configure Renovate (#162) 2021-04-07 10:53:58 +02: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.12.1"
    }
  }
}

# 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
}