Skip to content

Commit

Permalink
fix: Replace deprecated .latest attribute with new image_id. (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
Junkern authored Sep 5, 2022
1 parent ad65027 commit f34bec7
Show file tree
Hide file tree
Showing 44 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ resource "docker_image" "foo" {
resource "docker_container" "foo" {
name = "foo"
image = docker_image.foo.latest
image = docker_image.foo.image_id
}
```

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ resource "docker_image" "nginx" {
# -> same as 'docker run --name nginx -p8080:80 -d nginx:latest'
resource "docker_container" "nginx" {
name = "nginx"
image = docker_image.nginx.latest
image = docker_image.nginx.image_id
ports {
external = 8080
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ resource "docker_image" "ubuntu" {
# Create a container
resource "docker_container" "foo" {
image = docker_image.ubuntu.latest
image = docker_image.ubuntu.image_id
name = "foo"
}
```
Expand All @@ -61,7 +61,7 @@ resource "docker_image" "ubuntu" {
# Create a container
resource "docker_container" "foo" {
image = docker_image.ubuntu.latest
image = docker_image.ubuntu.image_id
name = "foo"
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Manages the lifecycle of a Docker container.
# Start a container
resource "docker_container" "ubuntu" {
name = "foo"
image = docker_image.ubuntu.latest
image = docker_image.ubuntu.image_id
}
# Find the latest Ubuntu precise image.
Expand Down
2 changes: 1 addition & 1 deletion examples/provider/provider-tf12.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ resource "docker_image" "ubuntu" {

# Create a container
resource "docker_container" "foo" {
image = docker_image.ubuntu.latest
image = docker_image.ubuntu.image_id
name = "foo"
}
2 changes: 1 addition & 1 deletion examples/provider/provider-tf13.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ resource "docker_image" "ubuntu" {

# Create a container
resource "docker_container" "foo" {
image = docker_image.ubuntu.latest
image = docker_image.ubuntu.image_id
name = "foo"
}
2 changes: 1 addition & 1 deletion examples/resources/docker_container/resource.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Start a container
resource "docker_container" "ubuntu" {
name = "foo"
image = docker_image.ubuntu.latest
image = docker_image.ubuntu.image_id
}

# Find the latest Ubuntu precise image.
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/resource_docker_container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ func TestAccDockerContainer_multipleUploadContentsConfig(t *testing.T) {
resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
must_run = "false"
upload {
Expand Down Expand Up @@ -995,7 +995,7 @@ func TestAccDockerContainer_noUploadContentsConfig(t *testing.T) {
resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
must_run = "false"
upload {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ resource "docker_network" "test_network_2" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
network_mode = docker_network.test_network_1.name
networks = [docker_network.test_network_2.name]
network_alias = ["tftest-container"]
}

resource "docker_container" "bar" {
name = "tf-test-bar"
image = docker_image.foo.latest
image = docker_image.foo.image_id
network_mode = "bridge"
networks = [docker_network.test_network_2.name]
network_alias = ["tftest-container-foo"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {
}
resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
command = ["/bin/sh", "-c", "for i in $(seq 1 15); do sleep 1; done"]
attach = true
must_run = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
entrypoint = ["/bin/bash", "-c", "cat /proc/kmsg"]
user = "root:root"
restart = "on-failure"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

devices {
host_path = "/dev/zero"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {
}
resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
command = ["/bin/sh", "-c", "exit 123"]
attach = true
must_run = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

group_add = [
100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

group_add = [
1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

group_add = [
"users"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

healthcheck {
test = ["CMD", "/bin/true"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ resource "docker_image" "fooinit" {

resource "docker_container" "fooinit" {
name = "tf-test"
image = docker_image.fooinit.latest
image = docker_image.fooinit.image_id
init = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

ports {
internal = 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
command = ["/bin/sh", "-c", "for i in $(seq 1 10); do echo \"$i\"; done"]
attach = true
logs = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resource "docker_volume" "foo_mounts" {

resource "docker_container" "foo_mounts" {
name = "tf-test"
image = docker_image.foo_mounts.latest
image = docker_image.foo_mounts.image_id

mounts {
target = "/mount/test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

ports {
internal = 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

ports {
internal = 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resource "docker_image" "foo" {
}
resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
networks_advanced {
name = docker_network.test.name
ipv4_address = "10.0.1.123"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ resource "docker_image" "foo" {
}
resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
networks_advanced {
name = docker_network.test.name
ipv4_address = "10.0.1.123"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resource "docker_image" "foo" {
}
resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
networks_advanced {
name = docker_network.test.name
ipv6_address = "fd00:0:0:0::123"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
start = false
must_run = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

ports {
internal = 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ resource "docker_image" "foo" {
resource "docker_container" "foo" {
provider = "docker.private"
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {
}
resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
command = ["/bin/sleep", "15"]
read_only = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {
}
resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
command = ["/bin/sleep", "15"]
rm = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
stdin_open = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

sysctls = {
"net.ipv4.ip_forward" = "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id
tty = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

tmpfs = {
"/mount/tmpfs" = "rw,noexec,nosuid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

restart = "on-failure"
max_retry_count = 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

upload {
content_base64 = base64encode("894fc3f56edf2d3a4c5fb5cb71df910f958a2ed8")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

upload {
content = "foo"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

upload {
source = "%s"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "docker_image" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

upload {
source = "%s"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resource "docker_volume" "foo" {

resource "docker_container" "foo" {
name = "tf-test"
image = docker_image.foo.latest
image = docker_image.foo.image_id

volumes {
volume_name = docker_volume.foo.name
Expand Down
Loading

0 comments on commit f34bec7

Please sign in to comment.