mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-18 23:06:10 -05:00
chore: Update docker/docker and docker/cli to newest stable (#695)
* chore: Updatedocker/docker and docker/cli to newest stable * fix: Update docker_container capabilities test * fix: Update setting of network options
This commit is contained in:
parent
c712f3f738
commit
13998c12bb
26 changed files with 220 additions and 177 deletions
|
|
@ -28,7 +28,7 @@ resource "docker_network" "private_network" {
|
|||
### Optional
|
||||
|
||||
- `attachable` (Boolean) Enable manual container attachment to the network.
|
||||
- `check_duplicate` (Boolean) Requests daemon to check for networks with same name.
|
||||
- `check_duplicate` (Boolean, Deprecated) Requests daemon to check for networks with same name.
|
||||
- `driver` (String) The driver of the Docker network. Possible values are `bridge`, `host`, `overlay`, `macvlan`. See [network docs](https://docs.docker.com/network/#network-drivers) for more details.
|
||||
- `ingress` (Boolean) Create swarm routing-mesh network. Defaults to `false`.
|
||||
- `internal` (Boolean) Whether the network is internal.
|
||||
|
|
|
|||
16
go.mod
16
go.mod
|
|
@ -4,9 +4,9 @@ go 1.22
|
|||
|
||||
require (
|
||||
github.com/client9/misspell v0.3.4
|
||||
github.com/docker/cli v20.10.27+incompatible
|
||||
github.com/docker/cli v28.0.4+incompatible
|
||||
github.com/docker/distribution v2.8.1+incompatible
|
||||
github.com/docker/docker v20.10.27+incompatible
|
||||
github.com/docker/docker v28.0.4+incompatible
|
||||
github.com/docker/go-connections v0.5.0
|
||||
github.com/docker/go-units v0.5.0
|
||||
github.com/golangci/golangci-lint v1.59.0
|
||||
|
|
@ -64,15 +64,18 @@ require (
|
|||
github.com/ckaznocha/intrange v0.1.2 // indirect
|
||||
github.com/containerd/cgroups v1.0.3 // indirect
|
||||
github.com/containerd/containerd v1.6.3-0.20220401172941-5ff8fce1fcc6 // indirect
|
||||
github.com/containerd/log v0.1.0 // indirect
|
||||
github.com/containerd/typeurl v1.0.2 // indirect
|
||||
github.com/curioswitch/go-reassign v0.2.0 // indirect
|
||||
github.com/daixiang0/gci v0.13.4 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/denis-tingaikin/go-header v0.5.0 // indirect
|
||||
github.com/distribution/reference v0.6.0 // indirect
|
||||
github.com/docker/docker-credential-helpers v0.6.4 // indirect
|
||||
github.com/ettle/strcase v0.2.0 // indirect
|
||||
github.com/fatih/color v1.17.0 // indirect
|
||||
github.com/fatih/structtag v1.2.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.2 // indirect
|
||||
github.com/firefart/nonamedreturns v1.0.5 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/fzipp/gocyclo v0.6.0 // indirect
|
||||
|
|
@ -143,6 +146,7 @@ require (
|
|||
github.com/katbyte/sergi-go-diff v1.1.1 // indirect
|
||||
github.com/kisielk/errcheck v1.7.0 // indirect
|
||||
github.com/kkHAIKE/contextcheck v1.1.5 // indirect
|
||||
github.com/klauspost/compress v1.15.1 // indirect
|
||||
github.com/kulti/thelper v0.6.3 // indirect
|
||||
github.com/kunwardeep/paralleltest v1.0.10 // indirect
|
||||
github.com/kyoh86/exportloopref v0.1.11 // indirect
|
||||
|
|
@ -167,9 +171,14 @@ require (
|
|||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||
github.com/moby/patternmatcher v0.6.0 // indirect
|
||||
github.com/moby/sys/mount v0.3.0 // indirect
|
||||
github.com/moby/sys/mountinfo v0.6.0 // indirect
|
||||
github.com/moby/sys/sequential v0.6.0 // indirect
|
||||
github.com/moby/sys/symlink v0.2.0 // indirect
|
||||
github.com/moby/sys/user v0.4.0 // indirect
|
||||
github.com/moby/sys/userns v0.1.0 // indirect
|
||||
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
|
||||
github.com/moricho/tparallel v0.3.1 // indirect
|
||||
github.com/morikuni/aec v1.0.0 // indirect
|
||||
|
|
@ -247,7 +256,10 @@ require (
|
|||
go-simpler.org/sloglint v0.7.0 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.29.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.29.0 // indirect
|
||||
go.opentelemetry.io/otel v1.4.1 // indirect
|
||||
go.opentelemetry.io/otel/internal/metric v0.27.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v0.27.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.4.1 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
go.uber.org/automaxprocs v1.5.3 // indirect
|
||||
|
|
|
|||
28
go.sum
28
go.sum
|
|
@ -294,6 +294,8 @@ github.com/containerd/imgcrypt v1.0.1/go.mod h1:mdd8cEPW7TPgNG4FpuP3sGBiQ7Yi/zak
|
|||
github.com/containerd/imgcrypt v1.0.4-0.20210301171431-0ae5c75f59ba/go.mod h1:6TNsg0ctmizkrOgXRNQjAPFWpMYRWuiB6dSF4Pfa5SA=
|
||||
github.com/containerd/imgcrypt v1.1.1-0.20210312161619-7ed62a527887/go.mod h1:5AZJNI6sLHJljKuI9IHnw1pWqo/F0nGDOuR9zgTs7ow=
|
||||
github.com/containerd/imgcrypt v1.1.1/go.mod h1:xpLnwiQmEUJPvQoAapeb2SNCxz7Xr6PJrXQb0Dpc4ms=
|
||||
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
|
||||
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
|
||||
github.com/containerd/nri v0.0.0-20201007170849-eb1350a75164/go.mod h1:+2wGSDGFYfE5+So4M5syatU0N0f0LbWpuqyMi4/BE8c=
|
||||
github.com/containerd/nri v0.0.0-20210316161719-dbaa18c31c14/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY=
|
||||
github.com/containerd/nri v0.1.0/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY=
|
||||
|
|
@ -364,10 +366,14 @@ github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8l
|
|||
github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
|
||||
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
|
||||
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
|
||||
github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||
github.com/docker/cli v20.10.27+incompatible h1:7FlIwTD2UWxWUq9YoMnEA1n//3Dmw35OpPjf7H/60Ug=
|
||||
github.com/docker/cli v20.10.27+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||
github.com/docker/cli v28.0.4+incompatible h1:pBJSJeNd9QeIWPjRcV91RVJihd/TXB77q1ef64XEu4A=
|
||||
github.com/docker/cli v28.0.4+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||
github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY=
|
||||
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
|
|
@ -376,6 +382,8 @@ github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4Kfc
|
|||
github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v20.10.27+incompatible h1:Id/ZooynV4ZlD6xX20RCd3SR0Ikn7r4QZDa2ECK2TgA=
|
||||
github.com/docker/docker v20.10.27+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v28.0.4+incompatible h1:JNNkBctYKurkw6FrHfKqY0nKIDf5nrbxjVBtS+cdcok=
|
||||
github.com/docker/docker v28.0.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y=
|
||||
github.com/docker/docker-credential-helpers v0.6.4 h1:axCks+yV+2MR3/kZhAmy07yC56WZ2Pwu/fKWtKuZB0o=
|
||||
github.com/docker/docker-credential-helpers v0.6.4/go.mod h1:ofX3UI0Gz1TteYBjtgs07O36Pyasyp66D2uKT7H8W1c=
|
||||
|
|
@ -417,6 +425,8 @@ github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
|
|||
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
|
||||
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
|
||||
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
|
||||
github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o=
|
||||
github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/firefart/nonamedreturns v1.0.5 h1:tM+Me2ZaXs8tfdDw3X6DOX++wMCOqzYUho6tUTYIdRA=
|
||||
github.com/firefart/nonamedreturns v1.0.5/go.mod h1:gHJjDqhGM4WyPt639SOZs+G89Ko7QKH5R5BhnO6xJhw=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
|
|
@ -772,6 +782,8 @@ github.com/kkHAIKE/contextcheck v1.1.5 h1:CdnJh63tcDe53vG+RebdpdXJTc9atMgGqdx8LX
|
|||
github.com/kkHAIKE/contextcheck v1.1.5/go.mod h1:O930cpht4xb1YQpK+1+AgoM3mFsvxr7uyFptcnWTYUA=
|
||||
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A=
|
||||
github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
|
|
@ -870,7 +882,11 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx
|
|||
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||
github.com/moby/buildkit v0.10.6 h1:DJlEuLIgnu34HQKF4n9Eg6q2YqQVC0eOpMb4p2eRS2w=
|
||||
github.com/moby/buildkit v0.10.6/go.mod h1:tQuuyTWtOb9D+RE425cwOCUkX0/oZ+5iBZ+uWpWQ9bU=
|
||||
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
|
||||
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
|
||||
github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
|
||||
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
|
||||
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
|
||||
github.com/moby/sys/mount v0.3.0 h1:bXZYMmq7DBQPwHRxH/MG+u9+XF90ZOwoXpHTOznMGp0=
|
||||
github.com/moby/sys/mount v0.3.0/go.mod h1:U2Z3ur2rXPFrFmy4q6WMwWrBOAQGYtYTRVM8BIvzbwk=
|
||||
github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
|
||||
|
|
@ -878,9 +894,15 @@ github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2J
|
|||
github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU=
|
||||
github.com/moby/sys/mountinfo v0.6.0 h1:gUDhXQx58YNrpHlK4nSL+7y2pxFZkUcXqzFDKWdC0Oo=
|
||||
github.com/moby/sys/mountinfo v0.6.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU=
|
||||
github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU=
|
||||
github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko=
|
||||
github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ=
|
||||
github.com/moby/sys/symlink v0.2.0 h1:tk1rOM+Ljp0nFmfOIBtlV3rTDlWOwFRhjEeAhZB0nZc=
|
||||
github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs=
|
||||
github.com/moby/sys/user v0.4.0 h1:jhcMKit7SA80hivmFJcbB1vqmw//wU61Zdui2eQXuMs=
|
||||
github.com/moby/sys/user v0.4.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs=
|
||||
github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g=
|
||||
github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28=
|
||||
github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo=
|
||||
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 h1:dcztxKSvZ4Id8iPpHERQBbIJfabdt4wUm5qy3wOL2Zc=
|
||||
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw=
|
||||
|
|
@ -1269,9 +1291,15 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
|||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.29.0 h1:n9b7AAdbQtQ0k9dm0Dm2/KUcUqtG8i2O15KzNaDze8c=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.29.0/go.mod h1:LsankqVDx4W+RhZNA5uWarULII/MBhF5qwCYxTuyXjs=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.29.0 h1:SLme4Porm+UwX0DdHMxlwRt7FzPSE0sys81bet2o0pU=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.29.0/go.mod h1:tLYsuf2v8fZreBVwp9gVMhefZlLFZaUiNVSq8QxXRII=
|
||||
go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk=
|
||||
go.opentelemetry.io/otel v1.4.1 h1:QbINgGDDcoQUoMJa2mMaWno49lja9sHwp6aoa2n3a4g=
|
||||
go.opentelemetry.io/otel v1.4.1/go.mod h1:StM6F/0fSwpd8dKWDCdRr7uRvEPYdW0hBSlbdTiUde4=
|
||||
go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk=
|
||||
go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw=
|
||||
go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ=
|
||||
go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g=
|
||||
go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE=
|
||||
go.opentelemetry.io/otel/trace v1.4.1 h1:O+16qcdTrT7zxv2J6GejTPFinSwA++cYerC5iSiF8EQ=
|
||||
go.opentelemetry.io/otel/trace v1.4.1/go.mod h1:iYEVbroFCNut9QkwEczV9vMRPHNKSSwYZjulEtsmhFc=
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/cli/cli/connhelper"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/client"
|
||||
)
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ func (c *Config) NewClient() (*client.Client, error) {
|
|||
|
||||
// Data structure for holding data that we fetch from Docker.
|
||||
type Data struct {
|
||||
DockerImages map[string]*types.ImageSummary
|
||||
DockerImages map[string]*image.Summary
|
||||
}
|
||||
|
||||
// ProviderConfig for the custom registry provider
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"log"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
|
@ -64,7 +64,7 @@ func dataSourceDockerImageRead(ctx context.Context, d *schema.ResourceData, meta
|
|||
// determineRepoDigest determines the repo digest for a local image name.
|
||||
// It will always return a digest and if none was found it returns an empty string.
|
||||
// See https://github.com/kreuzwerker/terraform-provider-docker/pull/212#discussion_r646025706 for details
|
||||
func determineRepoDigest(imageName string, imageToQuery *types.ImageSummary) string {
|
||||
func determineRepoDigest(imageName string, imageToQuery *image.Summary) string {
|
||||
// the edge case where the local image was pulled from a repo, tagged locally,
|
||||
// and then referred to in the data source by that local name/tag...
|
||||
if len(imageToQuery.RepoDigests) == 0 {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
|
||||
)
|
||||
|
|
@ -180,7 +180,7 @@ func removeImageForTest(ctx context.Context, s *terraform.State, imageName strin
|
|||
|
||||
filters := filters.NewArgs()
|
||||
filters.Add("reference", imageName)
|
||||
images, err := client.ImageList(ctx, types.ImageListOptions{
|
||||
images, err := client.ImageList(ctx, image.ListOptions{
|
||||
Filters: filters,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
@ -190,12 +190,12 @@ func removeImageForTest(ctx context.Context, s *terraform.State, imageName strin
|
|||
return fmt.Errorf("did not find any image with name '%s' to delete", imageName)
|
||||
}
|
||||
|
||||
for _, image := range images {
|
||||
_, err := client.ImageRemove(ctx, image.ID, types.ImageRemoveOptions{
|
||||
for _, currentImage := range images {
|
||||
_, err := client.ImageRemove(ctx, currentImage.ID, image.RemoveOptions{
|
||||
Force: true,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to remove image with ID '%s'", image.ID)
|
||||
return fmt.Errorf("failed to remove image with ID '%s'", currentImage.ID)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ package provider
|
|||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"github.com/docker/docker/api/types"
|
||||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
|
@ -84,11 +85,11 @@ func dataSourceDockerLogs() *schema.Resource {
|
|||
|
||||
func dataSourceDockerLogsRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
|
||||
client := meta.(*ProviderConfig).DockerClient
|
||||
container := d.Get("name").(string)
|
||||
d.SetId(container)
|
||||
containerId := d.Get("name").(string)
|
||||
d.SetId(containerId)
|
||||
|
||||
// call client for logs
|
||||
readCloser, err := client.ContainerLogs(ctx, container, types.ContainerLogsOptions{
|
||||
readCloser, err := client.ContainerLogs(ctx, containerId, container.LogsOptions{
|
||||
ShowStdout: d.Get("show_stdout").(bool),
|
||||
ShowStderr: d.Get("show_stderr").(bool),
|
||||
Since: d.Get("since").(string),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"log"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
|
|
@ -104,7 +103,7 @@ func dataSourceDockerNetworkRead(ctx context.Context, d *schema.ResourceData, me
|
|||
|
||||
client := meta.(*ProviderConfig).DockerClient
|
||||
|
||||
network, err := client.NetworkInspect(ctx, name.(string), types.NetworkInspectOptions{})
|
||||
network, err := client.NetworkInspect(ctx, name.(string), network.InspectOptions{})
|
||||
if err != nil {
|
||||
return diag.Errorf("Could not find docker network: %s", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/docker/cli/cli/config/configfile"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
|
|
@ -217,17 +217,17 @@ func configure(version string, p *schema.Provider) func(context.Context, *schema
|
|||
// AuthConfigs represents authentication options to use for the
|
||||
// PushImage method accommodating the new X-Registry-Config header
|
||||
type AuthConfigs struct {
|
||||
Configs map[string]types.AuthConfig `json:"configs"`
|
||||
Configs map[string]registry.AuthConfig `json:"configs"`
|
||||
}
|
||||
|
||||
// Take the given registry_auth schemas and return a map of registry auth configurations
|
||||
func providerSetToRegistryAuth(authList *schema.Set) (*AuthConfigs, error) {
|
||||
authConfigs := AuthConfigs{
|
||||
Configs: make(map[string]types.AuthConfig),
|
||||
Configs: make(map[string]registry.AuthConfig),
|
||||
}
|
||||
|
||||
for _, auth := range authList.List() {
|
||||
authConfig := types.AuthConfig{}
|
||||
authConfig := registry.AuthConfig{}
|
||||
address := auth.(map[string]interface{})["address"].(string)
|
||||
authConfig.ServerAddress = normalizeRegistryAddress(address)
|
||||
registryHostname := convertToHostname(authConfig.ServerAddress)
|
||||
|
|
@ -311,11 +311,7 @@ func providerSetToRegistryAuth(authList *schema.Set) (*AuthConfigs, error) {
|
|||
func loadConfigFile(configData io.Reader) (*configfile.ConfigFile, error) {
|
||||
configFile := configfile.New("")
|
||||
if err := configFile.LoadFromReader(configData); err != nil {
|
||||
log.Println("[DEBUG] Error parsing registry config: ", err)
|
||||
log.Println("[DEBUG] Will try parsing from legacy format")
|
||||
if err := configFile.LegacyLoadFromReader(configData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return configFile, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ func resourceDockerContainerCreate(ctx context.Context, d *schema.ResourceData,
|
|||
Privileged: d.Get("privileged").(bool),
|
||||
PublishAllPorts: d.Get("publish_all_ports").(bool),
|
||||
RestartPolicy: container.RestartPolicy{
|
||||
Name: d.Get("restart").(string),
|
||||
Name: container.RestartPolicyMode(d.Get("restart").(string)),
|
||||
MaximumRetryCount: d.Get("max_retry_count").(int),
|
||||
},
|
||||
Runtime: d.Get("runtime").(string),
|
||||
|
|
@ -397,7 +397,7 @@ func resourceDockerContainerCreate(ctx context.Context, d *schema.ResourceData,
|
|||
hostConfig.StorageOpt = mapTypeMapValsToString(v.(map[string]interface{}))
|
||||
}
|
||||
|
||||
var retContainer container.ContainerCreateCreatedBody
|
||||
var retContainer container.CreateResponse
|
||||
|
||||
// TODO mavogel add platform later which comes from API v1.41. Currently we pass nil
|
||||
if retContainer, err = client.ContainerCreate(ctx, config, hostConfig, networkingConfig, nil, d.Get("name").(string)); err != nil {
|
||||
|
|
@ -508,7 +508,7 @@ func resourceDockerContainerCreate(ctx context.Context, d *schema.ResourceData,
|
|||
|
||||
dstPath := "/"
|
||||
uploadContent := bytes.NewReader(buf.Bytes())
|
||||
options := types.CopyToContainerOptions{}
|
||||
options := container.CopyToContainerOptions{}
|
||||
if err := client.CopyToContainer(ctx, retContainer.ID, dstPath, uploadContent, options); err != nil {
|
||||
return diag.Errorf("Unable to upload volume content: %s", err)
|
||||
}
|
||||
|
|
@ -517,7 +517,7 @@ func resourceDockerContainerCreate(ctx context.Context, d *schema.ResourceData,
|
|||
|
||||
if d.Get("start").(bool) {
|
||||
creationTime = time.Now()
|
||||
options := types.ContainerStartOptions{}
|
||||
options := container.StartOptions{}
|
||||
if err := client.ContainerStart(ctx, retContainer.ID, options); err != nil {
|
||||
return diag.Errorf("Unable to start container: %s", err)
|
||||
}
|
||||
|
|
@ -563,7 +563,7 @@ func resourceDockerContainerCreate(ctx context.Context, d *schema.ResourceData,
|
|||
if d.Get("logs").(bool) {
|
||||
go func() {
|
||||
defer func() { logsRead <- true }()
|
||||
reader, err := client.ContainerLogs(ctx, retContainer.ID, types.ContainerLogsOptions{
|
||||
reader, err := client.ContainerLogs(ctx, retContainer.ID, container.LogsOptions{
|
||||
ShowStdout: true,
|
||||
ShowStderr: true,
|
||||
Follow: true,
|
||||
|
|
@ -651,7 +651,7 @@ func resourceDockerContainerRead(ctx context.Context, d *schema.ResourceData, me
|
|||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
container := containerRaw.(types.ContainerJSON)
|
||||
container := containerRaw.(container.InspectResponse)
|
||||
jsonObj, _ := json.MarshalIndent(container, "", "\t")
|
||||
log.Printf("[DEBUG] Docker container inspect from stateFunc: %s", jsonObj)
|
||||
|
||||
|
|
@ -799,7 +799,7 @@ func resourceDockerContainerReadRefreshFunc(ctx context.Context,
|
|||
client := meta.(*ProviderConfig).DockerClient
|
||||
containerID := d.Id()
|
||||
|
||||
var container types.ContainerJSON
|
||||
var container container.InspectResponse
|
||||
container, err := client.ContainerInspect(ctx, containerID)
|
||||
if err != nil {
|
||||
return container, "pending", err
|
||||
|
|
@ -862,7 +862,7 @@ func resourceDockerContainerUpdate(ctx context.Context, d *schema.ResourceData,
|
|||
|
||||
updateConfig := container.UpdateConfig{
|
||||
RestartPolicy: container.RestartPolicy{
|
||||
Name: d.Get("restart").(string),
|
||||
Name: container.RestartPolicyMode(d.Get("restart").(string)),
|
||||
MaximumRetryCount: d.Get("max_retry_count").(int),
|
||||
},
|
||||
Resources: container.Resources{
|
||||
|
|
@ -897,18 +897,18 @@ func resourceDockerContainerDelete(ctx context.Context, d *schema.ResourceData,
|
|||
|
||||
if !d.Get("attach").(bool) {
|
||||
// Stop the container before removing if destroy_grace_seconds is defined
|
||||
var timeout time.Duration
|
||||
var timeout int
|
||||
if d.Get("destroy_grace_seconds").(int) > 0 {
|
||||
timeout = time.Duration(int32(d.Get("destroy_grace_seconds").(int))) * time.Second
|
||||
timeout = d.Get("destroy_grace_seconds").(int)
|
||||
}
|
||||
|
||||
log.Printf("[INFO] Stopping Container '%s' with timeout %v", d.Id(), timeout)
|
||||
if err := client.ContainerStop(ctx, d.Id(), &timeout); err != nil {
|
||||
if err := client.ContainerStop(ctx, d.Id(), *&container.StopOptions{Timeout: &timeout}); err != nil { //nolint
|
||||
return diag.Errorf("Error stopping container %s: %s", d.Id(), err)
|
||||
}
|
||||
}
|
||||
|
||||
removeOpts := types.ContainerRemoveOptions{
|
||||
removeOpts := container.RemoveOptions{
|
||||
RemoveVolumes: d.Get("remove_volumes").(bool),
|
||||
RemoveLinks: d.Get("rm").(bool),
|
||||
Force: true,
|
||||
|
|
@ -942,8 +942,8 @@ func resourceDockerContainerDelete(ctx context.Context, d *schema.ResourceData,
|
|||
return nil
|
||||
}
|
||||
|
||||
func fetchDockerContainer(ctx context.Context, ID string, client *client.Client) (*types.Container, error) {
|
||||
apiContainers, err := client.ContainerList(ctx, types.ContainerListOptions{All: true})
|
||||
func fetchDockerContainer(ctx context.Context, ID string, client *client.Client) (*container.Summary, error) {
|
||||
apiContainers, err := client.ContainerList(ctx, container.ListOptions{All: true})
|
||||
if err != nil {
|
||||
// ST1005: error strings should not end with punctuation or newlines
|
||||
return nil, fmt.Errorf("error fetching container information from Docker: %s\n", err) //nolint:staticcheck
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/docker/go-units"
|
||||
|
|
@ -58,7 +57,7 @@ func flattenContainerPorts(in nat.PortMap) []interface{} {
|
|||
return out
|
||||
}
|
||||
|
||||
func flattenContainerNetworks(in *types.NetworkSettings) []interface{} {
|
||||
func flattenContainerNetworks(in *container.NetworkSettings) []interface{} {
|
||||
out := make([]interface{}, 0)
|
||||
if in == nil || in.Networks == nil || len(in.Networks) == 0 {
|
||||
return out
|
||||
|
|
@ -261,7 +260,7 @@ func deviceSetToDockerDevices(devices *schema.Set) []container.DeviceMapping {
|
|||
return retDevices
|
||||
}
|
||||
|
||||
func getDockerContainerMounts(container types.ContainerJSON) []map[string]interface{} {
|
||||
func getDockerContainerMounts(container container.InspectResponse) []map[string]interface{} {
|
||||
mounts := []map[string]interface{}{}
|
||||
for _, mount := range container.HostConfig.Mounts {
|
||||
m := map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
|
||||
)
|
||||
|
|
@ -39,7 +38,7 @@ func TestAccDockerContainer_private_image(t *testing.T) {
|
|||
dockerConfig := strings.ReplaceAll(filepath.Join(wd, "..", "..", "scripts", "testing", "dockerconfig.json"), "\\", "\\\\")
|
||||
ctx := context.Background()
|
||||
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
ProviderFactories: providerFactories,
|
||||
|
|
@ -59,7 +58,7 @@ func TestAccDockerContainer_private_image(t *testing.T) {
|
|||
|
||||
func TestAccDockerContainer_basic(t *testing.T) {
|
||||
resourceName := "docker_container.foo"
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
ProviderFactories: providerFactories,
|
||||
|
|
@ -108,7 +107,7 @@ func TestAccDockerContainer_basic(t *testing.T) {
|
|||
|
||||
func TestAccDockerContainer_init(t *testing.T) {
|
||||
resourceName := "docker_container.fooinit"
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
ProviderFactories: providerFactories,
|
||||
|
|
@ -149,7 +148,7 @@ func TestAccDockerContainer_init(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_basic_network(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
ProviderFactories: providerFactories,
|
||||
|
|
@ -175,7 +174,7 @@ func TestAccDockerContainer_basic_network(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_2networks_withmode(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
ProviderFactories: providerFactories,
|
||||
|
|
@ -207,7 +206,7 @@ func TestAccDockerContainer_2networks_withmode(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_volume(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
if len(c.Mounts) != 1 {
|
||||
|
|
@ -249,7 +248,7 @@ func TestAccDockerContainer_volume(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_mounts(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
if len(c.Mounts) != 2 {
|
||||
|
|
@ -281,7 +280,7 @@ func TestAccDockerContainer_mounts(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_tmpfs(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
if len(c.HostConfig.Tmpfs) != 1 {
|
||||
|
|
@ -313,7 +312,7 @@ func TestAccDockerContainer_tmpfs(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_sysctls(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
if len(c.HostConfig.Sysctls) != 1 {
|
||||
|
|
@ -347,7 +346,7 @@ func TestAccDockerContainer_sysctls(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_groupadd_id(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
if len(c.HostConfig.GroupAdd) != 1 || c.HostConfig.GroupAdd[0] != "100" {
|
||||
|
|
@ -372,7 +371,7 @@ func TestAccDockerContainer_groupadd_id(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_groupadd_name(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
if len(c.HostConfig.GroupAdd) != 1 || c.HostConfig.GroupAdd[0] != "users" {
|
||||
|
|
@ -397,7 +396,7 @@ func TestAccDockerContainer_groupadd_name(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_groupadd_multiple(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
if len(c.HostConfig.GroupAdd) != 3 {
|
||||
|
|
@ -422,7 +421,7 @@ func TestAccDockerContainer_groupadd_multiple(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_tty(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
if !c.Config.Tty {
|
||||
|
|
@ -447,7 +446,7 @@ func TestAccDockerContainer_tty(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_STDIN_Enabled(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
if !c.Config.OpenStdin {
|
||||
|
|
@ -472,7 +471,7 @@ func TestAccDockerContainer_STDIN_Enabled(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_customized(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
if len(c.Config.Entrypoint) < 3 ||
|
||||
|
|
@ -550,7 +549,7 @@ func TestAccDockerContainer_customized(t *testing.T) {
|
|||
return fmt.Errorf("Container does not have the correct number of Capabilities in Drop: %d", len(c.HostConfig.CapDrop))
|
||||
}
|
||||
|
||||
if c.HostConfig.CapDrop[0] != "SYS_ADMIN" {
|
||||
if c.HostConfig.CapDrop[0] != "CAP_SYS_ADMIN" {
|
||||
return fmt.Errorf("Container has wrong CapDrop setting: %v", c.HostConfig.CapDrop[0])
|
||||
}
|
||||
|
||||
|
|
@ -676,7 +675,7 @@ func testAccCheckSwapLimit(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_uploadPermission(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
ctx := context.Background()
|
||||
|
||||
testCheck := func(expected_mode string) func(*terraform.State) error {
|
||||
|
|
@ -748,7 +747,7 @@ func TestAccDockerContainer_uploadPermission(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_uploadSource(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
ctx := context.Background()
|
||||
|
||||
wd, _ := os.Getwd()
|
||||
|
|
@ -825,7 +824,7 @@ func TestAccDockerContainer_uploadSource(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_uploadSourceHash(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
var firstRunId string
|
||||
|
||||
wd, _ := os.Getwd()
|
||||
|
|
@ -869,7 +868,7 @@ func TestAccDockerContainer_uploadSourceHash(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_uploadAsBase64(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
ctx := context.Background()
|
||||
|
||||
testCheck := func(srcPath, wantedContent, filePerm string) func(*terraform.State) error {
|
||||
|
|
@ -1016,13 +1015,13 @@ func TestAccDockerContainer_noUploadContentsConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_device(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
ctx := context.Background()
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
client := testAccProvider.Meta().(*ProviderConfig).DockerClient
|
||||
|
||||
createExecOpts := types.ExecConfig{
|
||||
createExecOpts := container.ExecOptions{
|
||||
Cmd: []string{"dd", "if=/dev/zero_test", "of=/tmp/test.txt", "count=10", "bs=1"},
|
||||
}
|
||||
|
||||
|
|
@ -1031,7 +1030,7 @@ func TestAccDockerContainer_device(t *testing.T) {
|
|||
return fmt.Errorf("Unable to create a exec instance on container: %s", err)
|
||||
}
|
||||
|
||||
startExecOpts := types.ExecStartCheck{}
|
||||
startExecOpts := container.ExecStartOptions{}
|
||||
if err := client.ContainerExecStart(ctx, exec.ID, startExecOpts); err != nil {
|
||||
return fmt.Errorf("Unable to run exec a instance on container: %s", err)
|
||||
}
|
||||
|
|
@ -1081,7 +1080,7 @@ func TestAccDockerContainer_device(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_port_internal(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
// QF1008: could remove embedded field "NetworkSettingsBase" from selector
|
||||
|
|
@ -1129,7 +1128,7 @@ func TestAccDockerContainer_port_internal(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_port_multiple_internal(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
// QF1008: could remove embedded field "NetworkSettingsBase" from selector
|
||||
|
|
@ -1199,7 +1198,7 @@ func TestAccDockerContainer_port_multiple_internal(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_port(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
// QF1008: could remove embedded field "NetworkSettingsBase" from selector
|
||||
|
|
@ -1255,7 +1254,7 @@ func TestAccDockerContainer_port(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_multiple_ports(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
// QF1008: could remove embedded field "NetworkSettingsBase" from selector
|
||||
|
|
@ -1325,7 +1324,7 @@ func TestAccDockerContainer_multiple_ports(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_rm(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
ctx := context.Background()
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
|
|
@ -1355,7 +1354,7 @@ func TestAccDockerContainer_rm(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_readonly(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
if !c.HostConfig.ReadonlyRootfs {
|
||||
|
|
@ -1383,7 +1382,7 @@ func TestAccDockerContainer_readonly(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_healthcheck(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
testCheck := func(*terraform.State) error {
|
||||
if !reflect.DeepEqual(c.Config.Healthcheck.Test, []string{"CMD", "/bin/true"}) {
|
||||
return fmt.Errorf("Container doesn't have a correct healthcheck test")
|
||||
|
|
@ -1418,7 +1417,7 @@ func TestAccDockerContainer_healthcheck(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_nostart(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
ProviderFactories: providerFactories,
|
||||
|
|
@ -1434,7 +1433,7 @@ func TestAccDockerContainer_nostart(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_attach(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
|
|
@ -1454,7 +1453,7 @@ func TestAccDockerContainer_attach(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_logs(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
|
|
@ -1476,7 +1475,7 @@ func TestAccDockerContainer_logs(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_exitcode(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
|
|
@ -1495,7 +1494,7 @@ func TestAccDockerContainer_exitcode(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_ipv4address(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
networks := c.NetworkSettings.Networks
|
||||
|
|
@ -1535,7 +1534,7 @@ func TestAccDockerContainer_ipv4address(t *testing.T) {
|
|||
|
||||
func TestAccDockerContainer_ipv6address(t *testing.T) {
|
||||
t.Skip("mavogel: need to fix ipv6 network state")
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
networks := c.NetworkSettings.Networks
|
||||
|
|
@ -1576,7 +1575,7 @@ func TestAccDockerContainer_ipv6address(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerContainer_dualstackaddress(t *testing.T) {
|
||||
var c types.ContainerJSON
|
||||
var c container.InspectResponse
|
||||
|
||||
testCheck := func(*terraform.State) error {
|
||||
networks := c.NetworkSettings.Networks
|
||||
|
|
@ -1619,7 +1618,7 @@ func TestAccDockerContainer_dualstackaddress(t *testing.T) {
|
|||
// /////////
|
||||
// HELPERS
|
||||
// /////////
|
||||
func testAccContainerRunning(resourceName string, container *types.ContainerJSON) resource.TestCheckFunc {
|
||||
func testAccContainerRunning(resourceName string, runningContainer *container.InspectResponse) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
ctx := context.Background()
|
||||
rs, ok := s.RootModule().Resources[resourceName]
|
||||
|
|
@ -1632,7 +1631,7 @@ func testAccContainerRunning(resourceName string, container *types.ContainerJSON
|
|||
}
|
||||
|
||||
client := testAccProvider.Meta().(*ProviderConfig).DockerClient
|
||||
containers, err := client.ContainerList(ctx, types.ContainerListOptions{})
|
||||
containers, err := client.ContainerList(ctx, container.ListOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -1643,7 +1642,7 @@ func testAccContainerRunning(resourceName string, container *types.ContainerJSON
|
|||
if err != nil {
|
||||
return fmt.Errorf("Container could not be inspected: %s", err)
|
||||
}
|
||||
*container = inspected
|
||||
*runningContainer = inspected
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
@ -1652,7 +1651,7 @@ func testAccContainerRunning(resourceName string, container *types.ContainerJSON
|
|||
}
|
||||
}
|
||||
|
||||
func testAccContainerNotRunning(n string, container *types.ContainerJSON) resource.TestCheckFunc {
|
||||
func testAccContainerNotRunning(n string, runningContainer *container.InspectResponse) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
ctx := context.Background()
|
||||
rs, ok := s.RootModule().Resources[n]
|
||||
|
|
@ -1665,7 +1664,7 @@ func testAccContainerNotRunning(n string, container *types.ContainerJSON) resour
|
|||
}
|
||||
|
||||
client := testAccProvider.Meta().(*ProviderConfig).DockerClient
|
||||
containers, err := client.ContainerList(ctx, types.ContainerListOptions{
|
||||
containers, err := client.ContainerList(ctx, container.ListOptions{
|
||||
All: true,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
@ -1678,9 +1677,9 @@ func testAccContainerNotRunning(n string, container *types.ContainerJSON) resour
|
|||
if err != nil {
|
||||
return fmt.Errorf("Container could not be inspected: %s", err)
|
||||
}
|
||||
*container = inspected
|
||||
*runningContainer = inspected
|
||||
|
||||
if container.State.Running {
|
||||
if runningContainer.State.Running {
|
||||
return fmt.Errorf("Container is running: %s", rs.Primary.ID)
|
||||
}
|
||||
}
|
||||
|
|
@ -1690,7 +1689,7 @@ func testAccContainerNotRunning(n string, container *types.ContainerJSON) resour
|
|||
}
|
||||
}
|
||||
|
||||
func testAccContainerWaitConditionNotRunning(n string, ct *types.ContainerJSON) resource.TestCheckFunc {
|
||||
func testAccContainerWaitConditionNotRunning(n string, ct *container.InspectResponse) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
ctx := context.Background()
|
||||
rs, ok := s.RootModule().Resources[n]
|
||||
|
|
@ -1720,7 +1719,7 @@ func testAccContainerWaitConditionNotRunning(n string, ct *types.ContainerJSON)
|
|||
}
|
||||
}
|
||||
|
||||
func testAccContainerWaitConditionRemoved(ctx context.Context, n string, ct *types.ContainerJSON) resource.TestCheckFunc {
|
||||
func testAccContainerWaitConditionRemoved(ctx context.Context, n string, ct *container.InspectResponse) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
rs, ok := s.RootModule().Resources[n]
|
||||
if !ok {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import (
|
|||
|
||||
"github.com/docker/cli/cli/command/image/build"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/docker/errdefs"
|
||||
|
|
@ -109,8 +111,8 @@ func resourceDockerImageDelete(ctx context.Context, d *schema.ResourceData, meta
|
|||
}
|
||||
|
||||
// Helpers
|
||||
func searchLocalImages(ctx context.Context, client *client.Client, data Data, imageName string) (*types.ImageSummary, error) {
|
||||
imageInspect, _, err := client.ImageInspectWithRaw(ctx, imageName)
|
||||
func searchLocalImages(ctx context.Context, client *client.Client, data Data, imageName string) (*image.Summary, error) {
|
||||
imageInspect, err := client.ImageInspect(ctx, imageName)
|
||||
if err != nil {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, nil
|
||||
|
|
@ -153,7 +155,7 @@ func removeImage(ctx context.Context, d *schema.ResourceData, client *client.Cli
|
|||
}
|
||||
|
||||
if foundImage != nil {
|
||||
imageDeleteResponseItems, err := client.ImageRemove(ctx, imageName, types.ImageRemoveOptions{
|
||||
imageDeleteResponseItems, err := client.ImageRemove(ctx, imageName, image.RemoveOptions{
|
||||
Force: d.Get("force_remove").(bool),
|
||||
})
|
||||
if err != nil {
|
||||
|
|
@ -167,13 +169,13 @@ func removeImage(ctx context.Context, d *schema.ResourceData, client *client.Cli
|
|||
}
|
||||
|
||||
func fetchLocalImages(ctx context.Context, data *Data, client *client.Client) error {
|
||||
images, err := client.ImageList(ctx, types.ImageListOptions{All: false})
|
||||
images, err := client.ImageList(ctx, image.ListOptions{All: false})
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to list Docker images: %w", err)
|
||||
}
|
||||
|
||||
if data.DockerImages == nil {
|
||||
data.DockerImages = make(map[string]*types.ImageSummary)
|
||||
data.DockerImages = make(map[string]*image.Summary)
|
||||
}
|
||||
|
||||
// Docker uses different nomenclatures in different places...sometimes a short
|
||||
|
|
@ -193,10 +195,10 @@ func fetchLocalImages(ctx context.Context, data *Data, client *client.Client) er
|
|||
return nil
|
||||
}
|
||||
|
||||
func pullImage(ctx context.Context, data *Data, client *client.Client, authConfig *AuthConfigs, image string, platform string) error {
|
||||
pullOpts := parseImageOptions(image)
|
||||
func pullImage(ctx context.Context, data *Data, client *client.Client, authConfig *AuthConfigs, imageName string, platform string) error {
|
||||
pullOpts := parseImageOptions(imageName)
|
||||
|
||||
auth := types.AuthConfig{}
|
||||
auth := registry.AuthConfig{}
|
||||
if authConfig, ok := authConfig.Configs[pullOpts.Registry]; ok {
|
||||
auth = authConfig
|
||||
}
|
||||
|
|
@ -206,12 +208,12 @@ func pullImage(ctx context.Context, data *Data, client *client.Client, authConfi
|
|||
return fmt.Errorf("error creating auth config: %w", err)
|
||||
}
|
||||
|
||||
out, err := client.ImagePull(ctx, image, types.ImagePullOptions{
|
||||
out, err := client.ImagePull(ctx, imageName, image.PullOptions{
|
||||
RegistryAuth: base64.URLEncoding.EncodeToString(encodedJSON),
|
||||
Platform: platform,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("error pulling image %s: %w", image, err)
|
||||
return fmt.Errorf("error pulling image %s: %w", imageName, err)
|
||||
}
|
||||
defer out.Close() //nolint:errcheck
|
||||
|
||||
|
|
@ -220,7 +222,7 @@ func pullImage(ctx context.Context, data *Data, client *client.Client, authConfi
|
|||
return err
|
||||
}
|
||||
s := buf.String()
|
||||
log.Printf("[DEBUG] pulled image %v: %v", image, s)
|
||||
log.Printf("[DEBUG] pulled image %v: %v", imageName, s)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -281,7 +283,7 @@ func parseImageOptions(image string) internalPullImageOptions {
|
|||
return pullOpts
|
||||
}
|
||||
|
||||
func findImage(ctx context.Context, imageName string, client *client.Client, authConfig *AuthConfigs, platform string) (*types.ImageSummary, error) {
|
||||
func findImage(ctx context.Context, imageName string, client *client.Client, authConfig *AuthConfigs, platform string) (*image.Summary, error) {
|
||||
if imageName == "" {
|
||||
return nil, fmt.Errorf("empty image name is not allowed")
|
||||
}
|
||||
|
|
@ -420,7 +422,7 @@ func prepareBuildContext(specifiedContext string, specifiedDockerfile string) (i
|
|||
return nil, "", err
|
||||
}
|
||||
|
||||
specifiedDockerfile = archive.CanonicalTarNameForPath(specifiedDockerfile)
|
||||
// specifiedDockerfile = archive.CanonicalTarNameForPath(specifiedDockerfile)
|
||||
excludes = build.TrimBuildFilesFromExcludes(excludes, specifiedDockerfile, false)
|
||||
log.Printf("[DEBUG] Excludes: %v", excludes)
|
||||
buildCtx := getBuildContext(contextDir, excludes)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
|
||||
|
|
@ -68,7 +70,7 @@ func TestAccDockerRegistryImageResource_mapping(t *testing.T) {
|
|||
// DevSkim: ignore DS137138
|
||||
assert(*options.BuildArgs["HTTP_PROXY"] == "http://10.20.30.2:1234", "BuildArgs")
|
||||
assert(len(options.AuthConfigs) == 1, "AuthConfigs")
|
||||
assert(reflect.DeepEqual(options.AuthConfigs["foo.host"], types.AuthConfig{
|
||||
assert(reflect.DeepEqual(options.AuthConfigs["foo.host"], registry.AuthConfig{
|
||||
Username: "fooUserName",
|
||||
Password: "fooPassword",
|
||||
Auth: "fooAuth",
|
||||
|
|
@ -159,7 +161,7 @@ func TestAccDockerImage_basic(t *testing.T) {
|
|||
|
||||
func TestAccDockerImage_private(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
var i types.ImageInspect
|
||||
var i image.InspectResponse
|
||||
|
||||
testCheckImageInspect := func(*terraform.State) error {
|
||||
if len(i.RepoTags) != 1 ||
|
||||
|
|
@ -206,7 +208,7 @@ func TestAccDockerImage_destroy(t *testing.T) {
|
|||
}
|
||||
|
||||
client := testAccProvider.Meta().(*ProviderConfig).DockerClient
|
||||
_, _, err := client.ImageInspectWithRaw(ctx, rs.Primary.Attributes["name"])
|
||||
_, err := client.ImageInspect(ctx, rs.Primary.Attributes["name"])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -379,7 +381,7 @@ func testAccDockerImageDestroy(ctx context.Context, s *terraform.State) error {
|
|||
}
|
||||
|
||||
client := testAccProvider.Meta().(*ProviderConfig).DockerClient
|
||||
_, _, err := client.ImageInspectWithRaw(ctx, rs.Primary.Attributes["name"])
|
||||
_, err := client.ImageInspect(ctx, rs.Primary.Attributes["name"])
|
||||
if err == nil {
|
||||
return fmt.Errorf("Image still exists")
|
||||
}
|
||||
|
|
@ -642,7 +644,7 @@ func TestAccDockerImageResource_buildWithDockerignore(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testAccImageCreated(resourceName string, image *types.ImageInspect) resource.TestCheckFunc {
|
||||
func testAccImageCreated(resourceName string, image *image.InspectResponse) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
ctx := context.Background()
|
||||
rs, ok := s.RootModule().Resources[resourceName]
|
||||
|
|
@ -661,7 +663,7 @@ func testAccImageCreated(resourceName string, image *types.ImageInspect) resourc
|
|||
strippedID := strings.ReplaceAll(rs.Primary.ID, name, "")
|
||||
|
||||
client := testAccProvider.Meta().(*ProviderConfig).DockerClient
|
||||
inspectedImage, _, err := client.ImageInspectWithRaw(ctx, strippedID)
|
||||
inspectedImage, err := client.ImageInspect(ctx, strippedID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Image with ID '%s': %w", strippedID, err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ func resourceDockerNetwork() *schema.Resource {
|
|||
Description: "Requests daemon to check for networks with same name.",
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
Deprecated: "This option is deprecated and will be removed in a future version. The Docker daemon will always check for duplicate networks.",
|
||||
},
|
||||
|
||||
"driver": {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import (
|
|||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
|
||||
|
|
@ -25,13 +24,10 @@ const (
|
|||
func resourceDockerNetworkCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
|
||||
client := meta.(*ProviderConfig).DockerClient
|
||||
|
||||
createOpts := types.NetworkCreate{}
|
||||
createOpts := network.CreateOptions{}
|
||||
if v, ok := d.GetOk("labels"); ok {
|
||||
createOpts.Labels = labelSetToMap(v.(*schema.Set))
|
||||
}
|
||||
if v, ok := d.GetOk("check_duplicate"); ok {
|
||||
createOpts.CheckDuplicate = v.(bool)
|
||||
}
|
||||
if v, ok := d.GetOk("driver"); ok {
|
||||
createOpts.Driver = v.(string)
|
||||
}
|
||||
|
|
@ -48,7 +44,8 @@ func resourceDockerNetworkCreate(ctx context.Context, d *schema.ResourceData, me
|
|||
createOpts.Ingress = v.(bool)
|
||||
}
|
||||
if v, ok := d.GetOk("ipv6"); ok {
|
||||
createOpts.EnableIPv6 = v.(bool)
|
||||
enableIPv6 := v.(bool)
|
||||
createOpts.EnableIPv6 = &enableIPv6
|
||||
}
|
||||
|
||||
ipamOpts := &network.IPAM{}
|
||||
|
|
@ -152,7 +149,7 @@ func resourceDockerNetworkReadRefreshFunc(ctx context.Context,
|
|||
client := meta.(*ProviderConfig).DockerClient
|
||||
networkID := d.Id()
|
||||
|
||||
retNetwork, _, err := client.NetworkInspectWithRaw(ctx, networkID, types.NetworkInspectOptions{})
|
||||
retNetwork, _, err := client.NetworkInspectWithRaw(ctx, networkID, network.InspectOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[WARN] Network (%s) not found, removing from state", networkID)
|
||||
d.SetId("")
|
||||
|
|
@ -198,7 +195,7 @@ func resourceDockerNetworkRemoveRefreshFunc(ctx context.Context,
|
|||
client := meta.(*ProviderConfig).DockerClient
|
||||
networkID := d.Id()
|
||||
|
||||
_, _, err := client.NetworkInspectWithRaw(ctx, networkID, types.NetworkInspectOptions{})
|
||||
_, _, err := client.NetworkInspectWithRaw(ctx, networkID, network.InspectOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[INFO] Network (%s) not found. Already removed", networkID)
|
||||
return networkID, "removed", nil
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
|
||||
)
|
||||
|
||||
func TestAccDockerNetwork_basic(t *testing.T) {
|
||||
var n types.NetworkResource
|
||||
var n network.Inspect
|
||||
resourceName := "docker_network.foo"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
|
|
@ -34,7 +34,7 @@ func TestAccDockerNetwork_basic(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerNetwork_full(t *testing.T) {
|
||||
var n types.NetworkResource
|
||||
var n network.Inspect
|
||||
resourceName := "docker_network.foo"
|
||||
|
||||
testCheckNetworkInspect := func(*terraform.State) error {
|
||||
|
|
@ -121,7 +121,7 @@ func TestAccDockerNetwork_full(t *testing.T) {
|
|||
|
||||
// TODO mavogel: add full network config test in #74 (import resources)
|
||||
|
||||
func testAccNetwork(n string, network *types.NetworkResource) resource.TestCheckFunc {
|
||||
func testAccNetwork(n string, networkToCheck *network.Inspect) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
ctx := context.Background()
|
||||
rs, ok := s.RootModule().Resources[n]
|
||||
|
|
@ -134,18 +134,18 @@ func testAccNetwork(n string, network *types.NetworkResource) resource.TestCheck
|
|||
}
|
||||
|
||||
client := testAccProvider.Meta().(*ProviderConfig).DockerClient
|
||||
networks, err := client.NetworkList(ctx, types.NetworkListOptions{})
|
||||
networks, err := client.NetworkList(ctx, network.ListOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, n := range networks {
|
||||
if n.ID == rs.Primary.ID {
|
||||
inspected, err := client.NetworkInspect(ctx, n.ID, types.NetworkInspectOptions{})
|
||||
inspected, err := client.NetworkInspect(ctx, n.ID, network.InspectOptions{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Network could not be obtained: %s", err)
|
||||
}
|
||||
*network = inspected
|
||||
*networkToCheck = inspected
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
@ -155,7 +155,7 @@ func testAccNetwork(n string, network *types.NetworkResource) resource.TestCheck
|
|||
}
|
||||
|
||||
func TestAccDockerNetwork_internal(t *testing.T) {
|
||||
var n types.NetworkResource
|
||||
var n network.Inspect
|
||||
resourceName := "docker_network.foo"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
|
|
@ -178,7 +178,7 @@ func TestAccDockerNetwork_internal(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testAccNetworkInternal(network *types.NetworkResource, internal bool) resource.TestCheckFunc {
|
||||
func testAccNetworkInternal(network *network.Inspect, internal bool) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
if network.Internal != internal {
|
||||
return fmt.Errorf("Bad value for attribute 'internal': %t", network.Internal)
|
||||
|
|
@ -188,7 +188,7 @@ func testAccNetworkInternal(network *types.NetworkResource, internal bool) resou
|
|||
}
|
||||
|
||||
func TestAccDockerNetwork_attachable(t *testing.T) {
|
||||
var n types.NetworkResource
|
||||
var n network.Inspect
|
||||
resourceName := "docker_network.foo"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
|
|
@ -211,7 +211,7 @@ func TestAccDockerNetwork_attachable(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testAccNetworkAttachable(network *types.NetworkResource, attachable bool) resource.TestCheckFunc {
|
||||
func testAccNetworkAttachable(network *network.Inspect, attachable bool) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
if network.Attachable != attachable {
|
||||
return fmt.Errorf("Bad value for attribute 'attachable': %t", network.Attachable)
|
||||
|
|
@ -222,7 +222,7 @@ func testAccNetworkAttachable(network *types.NetworkResource, attachable bool) r
|
|||
|
||||
func TestAccDockerNetwork_ingress(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
var n types.NetworkResource
|
||||
var n network.Inspect
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
|
|
@ -252,7 +252,7 @@ func TestAccDockerNetwork_ingress(t *testing.T) {
|
|||
|
||||
func removeSwarmIngressNetwork(ctx context.Context, t *testing.T) {
|
||||
client := testAccProvider.Meta().(*ProviderConfig).DockerClient
|
||||
networks, err := client.NetworkList(ctx, types.NetworkListOptions{})
|
||||
networks, err := client.NetworkList(ctx, network.ListOptions{})
|
||||
if err != nil {
|
||||
t.Errorf("failed to list swarm networks: %v", err)
|
||||
}
|
||||
|
|
@ -280,7 +280,7 @@ func nodeLeaveSwarm(ctx context.Context, t *testing.T) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func testAccNetworkIngress(network *types.NetworkResource, ingress bool) resource.TestCheckFunc {
|
||||
func testAccNetworkIngress(network *network.Inspect, ingress bool) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
if network.Ingress != ingress {
|
||||
return fmt.Errorf("Bad value for attribute 'ingress': %t", network.Ingress)
|
||||
|
|
@ -290,7 +290,7 @@ func testAccNetworkIngress(network *types.NetworkResource, ingress bool) resourc
|
|||
}
|
||||
|
||||
func TestAccDockerNetwork_ipv4(t *testing.T) {
|
||||
var n types.NetworkResource
|
||||
var n network.Inspect
|
||||
resourceName := "docker_network.foo"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
|
|
@ -313,7 +313,7 @@ func TestAccDockerNetwork_ipv4(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testAccNetworkIPv4(network *types.NetworkResource, internal bool) resource.TestCheckFunc {
|
||||
func testAccNetworkIPv4(network *network.Inspect, internal bool) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
if len(network.IPAM.Config) != 1 {
|
||||
return fmt.Errorf("Bad value for IPAM configuration count: %d", len(network.IPAM.Config))
|
||||
|
|
@ -327,7 +327,7 @@ func testAccNetworkIPv4(network *types.NetworkResource, internal bool) resource.
|
|||
|
||||
func TestAccDockerNetwork_ipv6(t *testing.T) {
|
||||
t.Skip("TODO mavogel: need to fix ipv6 network state")
|
||||
var n types.NetworkResource
|
||||
var n network.Inspect
|
||||
resourceName := "docker_network.foo"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
|
|
@ -352,7 +352,7 @@ func TestAccDockerNetwork_ipv6(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testAccNetworkIPv6(network *types.NetworkResource, internal bool) resource.TestCheckFunc { //nolint:unused
|
||||
func testAccNetworkIPv6(network *network.Inspect, internal bool) resource.TestCheckFunc { //nolint:unused
|
||||
return func(s *terraform.State) error {
|
||||
if !network.EnableIPv6 {
|
||||
return fmt.Errorf("Bad value for attribute 'ipv6': %t", network.EnableIPv6)
|
||||
|
|
@ -368,7 +368,7 @@ func testAccNetworkIPv6(network *types.NetworkResource, internal bool) resource.
|
|||
}
|
||||
|
||||
func TestAccDockerNetwork_labels(t *testing.T) {
|
||||
var n types.NetworkResource
|
||||
var n network.Inspect
|
||||
resourceName := "docker_network.foo"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ func validateFuncPluginName(val interface{}, key string) (warns []string, errs [
|
|||
return
|
||||
}
|
||||
|
||||
func getDockerPluginGrantPermissions(src interface{}) func(types.PluginPrivileges) (bool, error) {
|
||||
func getDockerPluginGrantPermissions(src interface{}) func(context.Context, types.PluginPrivileges) (bool, error) {
|
||||
grantPermissionsSet := src.(*schema.Set)
|
||||
grantPermissions := make(map[string]map[string]struct{}, grantPermissionsSet.Len())
|
||||
for _, b := range grantPermissionsSet.List() {
|
||||
|
|
@ -142,7 +142,7 @@ func getDockerPluginGrantPermissions(src interface{}) func(types.PluginPrivilege
|
|||
}
|
||||
grantPermissions[name] = grantPermission
|
||||
}
|
||||
return func(privileges types.PluginPrivileges) (bool, error) {
|
||||
return func(context context.Context, privileges types.PluginPrivileges) (bool, error) {
|
||||
for _, privilege := range privileges {
|
||||
grantPermission, nameOK := grantPermissions[privilege.Name]
|
||||
if !nameOK {
|
||||
|
|
|
|||
|
|
@ -211,8 +211,11 @@ func Test_getDockerPluginGrantPermissions(t *testing.T) {
|
|||
d := d
|
||||
t.Run(d.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
f := getDockerPluginGrantPermissions(d.src)
|
||||
b, err := f(d.privileges)
|
||||
c := context.Background()
|
||||
|
||||
b, err := f(c, d.privileges)
|
||||
if d.isErr {
|
||||
if err == nil {
|
||||
t.Fatal("error must be returned")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
|
|
@ -143,11 +145,11 @@ func createImageBuildOptions(buildOptions map[string]interface{}) types.ImageBui
|
|||
return ulimits
|
||||
}
|
||||
|
||||
readAuthConfigs := func(options []interface{}) map[string]types.AuthConfig {
|
||||
authConfigs := make(map[string]types.AuthConfig, len(options))
|
||||
readAuthConfigs := func(options []interface{}) map[string]registry.AuthConfig {
|
||||
authConfigs := make(map[string]registry.AuthConfig, len(options))
|
||||
for _, v := range options {
|
||||
authOptions := v.(map[string]interface{})
|
||||
auth := types.AuthConfig{
|
||||
auth := registry.AuthConfig{
|
||||
Username: authOptions["user_name"].(string),
|
||||
Password: authOptions["password"].(string),
|
||||
Auth: authOptions["auth"].(string),
|
||||
|
|
@ -199,9 +201,9 @@ func createImageBuildOptions(buildOptions map[string]interface{}) types.ImageBui
|
|||
}
|
||||
|
||||
func pushDockerRegistryImage(ctx context.Context, client *client.Client, pushOpts internalPushImageOptions, username string, password string) error {
|
||||
pushOptions := types.ImagePushOptions{}
|
||||
pushOptions := image.PushOptions{}
|
||||
if username != "" {
|
||||
auth := types.AuthConfig{Username: username, Password: password}
|
||||
auth := registry.AuthConfig{Username: username, Password: password}
|
||||
authBytes, err := json.Marshal(auth)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error creating push options: %s", err)
|
||||
|
|
@ -239,11 +241,11 @@ func pushDockerRegistryImage(ctx context.Context, client *client.Client, pushOpt
|
|||
|
||||
func getAuthConfigForRegistry(
|
||||
registryWithoutProtocol string,
|
||||
providerConfig *ProviderConfig) (types.AuthConfig, error) {
|
||||
providerConfig *ProviderConfig) (registry.AuthConfig, error) {
|
||||
if authConfig, ok := providerConfig.AuthConfigs.Configs[registryWithoutProtocol]; ok {
|
||||
return authConfig, nil
|
||||
}
|
||||
return types.AuthConfig{}, fmt.Errorf("no auth config found for registry %s in auth configs: %#v", registryWithoutProtocol, providerConfig.AuthConfigs.Configs)
|
||||
return registry.AuthConfig{}, fmt.Errorf("no auth config found for registry %s in auth configs: %#v", registryWithoutProtocol, providerConfig.AuthConfigs.Configs)
|
||||
}
|
||||
|
||||
func buildHttpClientForRegistry(registryAddressWithProtocol string, insecureSkipVerify bool) *http.Client {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
|
|
@ -305,7 +306,7 @@ func deleteService(ctx context.Context, serviceID string, d *schema.ResourceData
|
|||
}
|
||||
}
|
||||
|
||||
removeOpts := types.ContainerRemoveOptions{
|
||||
removeOpts := container.RemoveOptions{
|
||||
RemoveVolumes: true,
|
||||
Force: true,
|
||||
}
|
||||
|
|
@ -593,25 +594,25 @@ func terminalState(state swarm.TaskState) bool {
|
|||
}
|
||||
|
||||
// authToServiceAuth maps the auth to AuthConfiguration
|
||||
func authToServiceAuth(auths []interface{}) types.AuthConfig {
|
||||
func authToServiceAuth(auths []interface{}) registry.AuthConfig {
|
||||
if len(auths) == 0 {
|
||||
return types.AuthConfig{}
|
||||
return registry.AuthConfig{}
|
||||
}
|
||||
// it's maxItems = 1
|
||||
auth := auths[0].(map[string]interface{})
|
||||
if auth["username"] != nil && len(auth["username"].(string)) > 0 && auth["password"] != nil && len(auth["password"].(string)) > 0 {
|
||||
return types.AuthConfig{
|
||||
return registry.AuthConfig{
|
||||
Username: auth["username"].(string),
|
||||
Password: auth["password"].(string),
|
||||
ServerAddress: auth["server_address"].(string),
|
||||
}
|
||||
}
|
||||
|
||||
return types.AuthConfig{}
|
||||
return registry.AuthConfig{}
|
||||
}
|
||||
|
||||
// fromRegistryAuth extract the desired AuthConfiguration for the given image
|
||||
func fromRegistryAuth(image string, authConfigs map[string]types.AuthConfig) types.AuthConfig {
|
||||
func fromRegistryAuth(image string, authConfigs map[string]registry.AuthConfig) registry.AuthConfig {
|
||||
// Remove normalized prefixes to simplify substring
|
||||
// DevSkim: ignore DS137138
|
||||
image = strings.Replace(strings.Replace(image, "http://", "", 1), "https://", "", 1)
|
||||
|
|
@ -625,12 +626,12 @@ func fromRegistryAuth(image string, authConfigs map[string]types.AuthConfig) typ
|
|||
}
|
||||
}
|
||||
|
||||
return types.AuthConfig{}
|
||||
return registry.AuthConfig{}
|
||||
}
|
||||
|
||||
// retrieveAndMarshalAuth retrieves and marshals the service registry auth
|
||||
func retrieveAndMarshalAuth(d *schema.ResourceData, meta interface{}, stageType string) []byte {
|
||||
var auth types.AuthConfig
|
||||
var auth registry.AuthConfig
|
||||
// when a service is updated/set for the first time the auth is set but empty
|
||||
// this is why we need this additional check
|
||||
if rawAuth, ok := d.GetOk("auth"); ok && len(rawAuth.([]interface{})) != 0 {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/mount"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
|
||||
|
|
@ -227,8 +229,8 @@ func TestMigrateServiceLabelState_with_labels(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDockerSecretFromRegistryAuth_basic(t *testing.T) {
|
||||
authConfigs := make(map[string]types.AuthConfig)
|
||||
authConfigs["repo.my-company.com:8787"] = types.AuthConfig{
|
||||
authConfigs := make(map[string]registry.AuthConfig)
|
||||
authConfigs["repo.my-company.com:8787"] = registry.AuthConfig{
|
||||
Username: "myuser",
|
||||
Password: "mypass",
|
||||
Email: "",
|
||||
|
|
@ -243,20 +245,20 @@ func TestDockerSecretFromRegistryAuth_basic(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDockerSecretFromRegistryAuth_multiple(t *testing.T) {
|
||||
authConfigs := make(map[string]types.AuthConfig)
|
||||
authConfigs["repo.my-company.com:8787"] = types.AuthConfig{
|
||||
authConfigs := make(map[string]registry.AuthConfig)
|
||||
authConfigs["repo.my-company.com:8787"] = registry.AuthConfig{
|
||||
Username: "myuser",
|
||||
Password: "mypass",
|
||||
Email: "",
|
||||
ServerAddress: "https://repo.my-company.com:8787",
|
||||
}
|
||||
authConfigs["nexus.my-fancy-company.com"] = types.AuthConfig{
|
||||
authConfigs["nexus.my-fancy-company.com"] = registry.AuthConfig{
|
||||
Username: "myuser33",
|
||||
Password: "mypass123",
|
||||
Email: "test@example.com",
|
||||
ServerAddress: "https://nexus.my-fancy-company.com",
|
||||
}
|
||||
authConfigs["http-nexus.my-fancy-company.com"] = types.AuthConfig{
|
||||
authConfigs["http-nexus.my-fancy-company.com"] = registry.AuthConfig{
|
||||
Username: "myuser33",
|
||||
Password: "mypass123",
|
||||
Email: "test@example.com",
|
||||
|
|
@ -1385,7 +1387,7 @@ func checkAndRemoveImages(ctx context.Context, s *terraform.State) error {
|
|||
|
||||
filters := filters.NewArgs()
|
||||
filters.Add("reference", imagePattern)
|
||||
images, err := client.ImageList(ctx, types.ImageListOptions{
|
||||
images, err := client.ImageList(ctx, image.ListOptions{
|
||||
Filters: filters,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
@ -1394,14 +1396,14 @@ func checkAndRemoveImages(ctx context.Context, s *terraform.State) error {
|
|||
|
||||
retryDeleteCount := 0
|
||||
for i := 0; i < len(images); {
|
||||
image := images[i]
|
||||
_, err := client.ImageRemove(ctx, image.ID, types.ImageRemoveOptions{
|
||||
currentImage := images[i]
|
||||
_, err := client.ImageRemove(ctx, currentImage.ID, image.RemoveOptions{
|
||||
Force: true,
|
||||
})
|
||||
if err != nil {
|
||||
if containsIgnorableErrorMessage(err.Error(), "image is being used by running container") {
|
||||
if retryDeleteCount == maxRetryDeleteCount {
|
||||
return fmt.Errorf("could not delete image '%s' after %d retries", image.ID, maxRetryDeleteCount)
|
||||
return fmt.Errorf("could not delete image '%s' after %d retries", currentImage.ID, maxRetryDeleteCount)
|
||||
}
|
||||
<-time.After(time.Duration(retrySleepSeconds) * time.Second)
|
||||
retryDeleteCount++
|
||||
|
|
@ -1412,7 +1414,7 @@ func checkAndRemoveImages(ctx context.Context, s *terraform.State) error {
|
|||
i++
|
||||
}
|
||||
|
||||
imagesAfterDelete, err := client.ImageList(ctx, types.ImageListOptions{
|
||||
imagesAfterDelete, err := client.ImageList(ctx, image.ListOptions{
|
||||
Filters: filters,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ func resourceDockerTagCreate(ctx context.Context, d *schema.ResourceData, meta i
|
|||
if err != nil {
|
||||
return diag.Errorf("failed to create docker tag: %s", err)
|
||||
}
|
||||
imageInspect, _, err := client.ImageInspectWithRaw(ctx, sourceImage)
|
||||
imageInspect, err := client.ImageInspect(ctx, sourceImage)
|
||||
if err != nil {
|
||||
return diag.Errorf("failed to ImageInspectWithRaw: %s", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import (
|
|||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/volume"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
|
||||
|
|
@ -80,7 +79,7 @@ func resourceDockerVolume() *schema.Resource {
|
|||
func resourceDockerVolumeCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
|
||||
client := meta.(*ProviderConfig).DockerClient
|
||||
|
||||
createOpts := volume.VolumeCreateBody{}
|
||||
createOpts := volume.CreateOptions{}
|
||||
|
||||
if v, ok := d.GetOk("name"); ok {
|
||||
createOpts.Name = v.(string)
|
||||
|
|
@ -96,7 +95,7 @@ func resourceDockerVolumeCreate(ctx context.Context, d *schema.ResourceData, met
|
|||
}
|
||||
|
||||
var err error
|
||||
var retVolume types.Volume
|
||||
var retVolume volume.Volume
|
||||
retVolume, err = client.VolumeCreate(ctx, createOpts)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/volume"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
|
||||
)
|
||||
|
||||
func TestAccDockerVolume_basic(t *testing.T) {
|
||||
var v types.Volume
|
||||
var v volume.Volume
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
|
|
@ -39,7 +39,7 @@ func TestAccDockerVolume_basic(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerVolume_full(t *testing.T) {
|
||||
var v types.Volume
|
||||
var v volume.Volume
|
||||
|
||||
testCheckVolumeInspect := func(*terraform.State) error {
|
||||
if v.Driver != "local" {
|
||||
|
|
@ -88,7 +88,7 @@ func TestAccDockerVolume_full(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccDockerVolume_labels(t *testing.T) {
|
||||
var v types.Volume
|
||||
var v volume.Volume
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
|
|
@ -127,7 +127,7 @@ func TestAccDockerVolume_labels(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func checkDockerVolumeCreated(n string, volume *types.Volume) resource.TestCheckFunc {
|
||||
func checkDockerVolumeCreated(n string, volumeToCheck *volume.Volume) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
rs, ok := s.RootModule().Resources[n]
|
||||
if !ok {
|
||||
|
|
@ -145,7 +145,7 @@ func checkDockerVolumeCreated(n string, volume *types.Volume) resource.TestCheck
|
|||
return err
|
||||
}
|
||||
|
||||
*volume = v
|
||||
*volumeToCheck = v
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ resource "docker_container" "foo" {
|
|||
|
||||
capabilities {
|
||||
add = ["ALL"]
|
||||
drop = ["SYS_ADMIN"]
|
||||
drop = ["CAP_SYS_ADMIN"]
|
||||
}
|
||||
|
||||
security_opts = ["apparmor=unconfined", "label=disable"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue