fix: Use build_args everywhere and update documentation (#681)

Co-authored-by: Martin Wentzel <junker@monoceres.uberspace.de>
This commit is contained in:
Martin 2025-04-11 22:54:57 +02:00 committed by GitHub
parent d9e1cbc2cb
commit f1630865be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 7 additions and 17 deletions

View file

@ -42,6 +42,7 @@ resource "docker_image" "ubuntu" {
- `container_read_refresh_timeout_milliseconds` (Number) The total number of milliseconds to wait for the container to reach status 'running'
- `cpu_set` (String) A comma-separated list or hyphen-separated range of CPUs a container can use, e.g. `0-1`.
- `cpu_shares` (Number) CPU shares (relative weight) for the container.
- `cpus` (String) Specify how much of the available CPU resources a container can use. e.g a value of 1.5 means the container is guaranteed at most one and a half of the CPUs
- `destroy_grace_seconds` (Number) If defined will attempt to stop the container before destroying. Container will be destroyed after `n` seconds or on successful stop.
- `devices` (Block Set) Bind devices to the container. (see [below for nested schema](#nestedblock--devices))
- `dns` (Set of String) DNS servers to use.
@ -50,7 +51,6 @@ resource "docker_image" "ubuntu" {
- `domainname` (String) Domain name of the container.
- `entrypoint` (List of String) The command to use as the Entrypoint for the container. The Entrypoint allows you to configure a container to run as an executable. For example, to run `/usr/bin/myprogram` when starting a container, set the entrypoint to be `"/usr/bin/myprogra"]`.
- `env` (Set of String) Environment variables to set in the form of `KEY=VALUE`, e.g. `DEBUG=0`
- `cpus` (String) Specify how much of the available CPU resources a container can use. e.g a value of 1.5 means the container is guaranteed at most one and a half of the CPUs
- `gpus` (String) GPU devices to add to the container. Currently, only the value `all` is supported. Passing any other value will result in unexpected behavior.
- `group_add` (Set of String) Additional groups for the container user
- `healthcheck` (Block List, Max: 1) A test to perform to check that the container is healthy (see [below for nested schema](#nestedblock--healthcheck))
@ -67,7 +67,7 @@ resource "docker_image" "ubuntu" {
- `memory_swap` (Number) The total memory limit (memory + swap) for the container in MBs. This setting may compute to `-1` after `terraform apply` if the target host doesn't support memory swap, when that is the case docker will use a soft limitation.
- `mounts` (Block Set) Specification for mounts to be added to containers created as part of the service. (see [below for nested schema](#nestedblock--mounts))
- `must_run` (Boolean) If `true`, then the Docker container will be kept running. If `false`, then as long as the container exists, Terraform assumes it is successful. Defaults to `true`.
- `network_mode` (String) Network mode of the container.
- `network_mode` (String) Network mode of the container. See https://docs.docker.com/engine/network/ for more information.
- `networks_advanced` (Block Set) The networks the container is attached to (see [below for nested schema](#nestedblock--networks_advanced))
- `pid_mode` (String) he PID (Process) Namespace mode for the container. Either `container:<name|id>` or `host`.
- `ports` (Block List) Publish a container's port(s) to the host. (see [below for nested schema](#nestedblock--ports))

View file

@ -52,7 +52,7 @@ resource "docker_image" "zoo" {
build {
context = "."
tag = ["zoo:develop"]
build_arg = {
build_args = {
foo : "zoo"
}
label = {
@ -108,8 +108,7 @@ Required:
Optional:
- `auth_config` (Block List) The configuration for the authentication (see [below for nested schema](#nestedblock--build--auth_config))
- `build_arg` (Map of String) Set build-time variables
- `build_args` (Map of String) Pairs for build-time variables in the form TODO
- `build_args` (Map of String) Pairs for build-time variables in the form of `ENDPOINT : "https://example.com"`
- `build_id` (String) BuildID is an optional identifier that can be passed together with the build request. The same identifier can be used to gracefully cancel the build with the cancel request.
- `cache_from` (List of String) Images to consider as cache sources
- `cgroup_parent` (String) Optional parent cgroup for the container

View file

@ -3,7 +3,7 @@ resource "docker_image" "zoo" {
build {
context = "."
tag = ["zoo:develop"]
build_arg = {
build_args = {
foo : "zoo"
}
label = {

View file

@ -88,15 +88,6 @@ func resourceDockerImage() *schema.Resource {
Default: true,
Optional: true,
},
"build_arg": {
Type: schema.TypeMap,
Description: "Set build-time variables",
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
ForceNew: true,
},
"label": {
Type: schema.TypeMap,
Description: "Set metadata for an image",
@ -230,7 +221,7 @@ func resourceDockerImage() *schema.Resource {
},
"build_args": {
Type: schema.TypeMap,
Description: "Pairs for build-time variables in the form TODO",
Description: "Pairs for build-time variables in the form of `ENDPOINT : \"https://example.com\"`",
Optional: true,
ForceNew: true,
Elem: &schema.Schema{

View file

@ -4,7 +4,7 @@ resource "docker_image" "test" {
context = "."
dockerfile = "Dockerfile"
force_remove = true
build_arg = {
build_args = {
test_arg = "kenobi"
}
label = {