terraform-provider-docker/docs/v2_v3_migration.md

48 lines
1.4 KiB
Markdown
Raw Permalink Normal View History

2023-01-09 05:45:29 -05:00
# V2 to V3 Migration Guide
This guide is intended to help you migrate from V2 to V3 of the `terraform-provider-docker`.
The in the past minor versions there were many new attributes and older attributes are deprecated.
2023-01-09 05:45:29 -05:00
This will give you an overview over which attributes are deprecated and which attributes you should use instead.
## `docker_container`
Deprecated attributes:
2023-01-09 05:45:29 -05:00
* `links`: The --link flag is a legacy feature of Docker and will be removed (https://docs.docker.com/network/links/)
* `ip_address`, `ip_prefix_length`, `gateway`: Use the `network_data` block instead
* `network_alias`, `networks`: Use the `networks_advanced` block instead
2023-01-09 05:45:29 -05:00
## `docker_image`
* `latest`: Use `repo_digest` instead
* `pull_trigger`: Use `pull_triggers` instead
* `output`: Unused and will be removed
* `build.path`: Use `build.context` instead
## `docker_service`
* `networks`: Use the `networks_advanced` block instead
2023-01-09 05:45:29 -05:00
## `docker_registry_image`
The whole `build` block will be removed. Use the `build` block of the `docker_image` resource instead.
In order to push images to an registry, still use `docker_registry_image` and reference the `docker_image` resource:
```hcl
resource "docker_image" "foo_image" {
provider = "docker.private"
name = "somename"
build {
// your build params
2023-01-09 05:45:29 -05:00
}
}
resource "docker_registry_image" "foo" {
name = docker_image.foo_image.name
2023-01-09 05:45:29 -05:00
}
```