@pulumi/docker 4.11.0 → 4.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/service.js CHANGED
@@ -6,55 +6,310 @@ exports.Service = void 0;
6
6
  const pulumi = require("@pulumi/pulumi");
7
7
  const utilities = require("./utilities");
8
8
  /**
9
- * ## Import
9
+ * <!-- Bug: Type and Name are switched -->
10
+ * This resource manages the lifecycle of a Docker service. By default, the creation, update and delete of services are detached.
11
+ * With the Converge Config the behavior of the `docker cli` is imitated to guarantee tha for example, all tasks of a service are running or successfully updated or to inform `terraform` that a service could no be updated and was successfully rolled back.
10
12
  *
11
- * ### Example
13
+ * ## Example Usage
12
14
  *
13
- * Assuming you created a `service` as follows
15
+ * ### Basic
14
16
  *
15
- * #!/bin/bash
17
+ * The following configuration starts a Docker Service with
16
18
  *
17
- * docker service create --name foo -p 8080:80 nginx
19
+ * - the given image,
20
+ * - 1 replica
21
+ * - exposes the port `8080` in `vip` mode to the host machine
22
+ * - moreover, uses the `container` runtime
18
23
  *
19
- * prints th ID
24
+ * ```typescript
25
+ * import * as pulumi from "@pulumi/pulumi";
26
+ * import * as docker from "@pulumi/docker";
20
27
  *
21
- * 4pcphbxkfn2rffhbhe6czytgi
28
+ * const foo = new docker.Service("foo", {
29
+ * name: "foo-service",
30
+ * taskSpec: {
31
+ * containerSpec: {
32
+ * image: "repo.mycompany.com:8080/foo-service:v1",
33
+ * },
34
+ * },
35
+ * endpointSpec: {
36
+ * ports: [{
37
+ * targetPort: 8080,
38
+ * }],
39
+ * },
40
+ * });
41
+ * ```
22
42
  *
23
- * you provide the definition for the resource as follows
43
+ * The following command is the equivalent:
24
44
  *
25
- * terraform
45
+ * ### Basic with Datasource
26
46
  *
27
- * resource "docker_service" "foo" {
47
+ * Alternatively, if the image is already present on the Docker Host and not managed
48
+ * by `terraform`, you can also use the `docker.RemoteImage` datasource:
28
49
  *
29
- * name = "foo"
50
+ * ```typescript
51
+ * import * as pulumi from "@pulumi/pulumi";
52
+ * import * as docker from "@pulumi/docker";
30
53
  *
31
- * task_spec {
54
+ * const foo = docker.getRemoteImage({
55
+ * name: "repo.mycompany.com:8080/foo-service:v1",
56
+ * });
57
+ * const fooService = new docker.Service("foo", {
58
+ * name: "foo-service",
59
+ * taskSpec: {
60
+ * containerSpec: {
61
+ * image: foo.then(foo => foo.repoDigest),
62
+ * },
63
+ * },
64
+ * endpointSpec: {
65
+ * ports: [{
66
+ * targetPort: 8080,
67
+ * }],
68
+ * },
69
+ * });
70
+ * ```
32
71
  *
33
- * container_spec {
72
+ * ### Advanced
34
73
  *
35
- * image = "nginx"
74
+ * The following configuration shows the full capabilities of a Docker Service,
75
+ * with a `volume`, `config`, `secret` and `network`
36
76
  *
37
- * }
77
+ * ```typescript
78
+ * import * as pulumi from "@pulumi/pulumi";
79
+ * import * as docker from "@pulumi/docker";
38
80
  *
39
- * }
81
+ * const testVolume = new docker.Volume("test_volume", {name: "tftest-volume"});
82
+ * const testVolume2 = new docker.Volume("test_volume_2", {name: "tftest-volume2"});
83
+ * const serviceConfig = new docker.ServiceConfig("service_config", {
84
+ * name: "tftest-full-myconfig",
85
+ * data: "ewogICJwcmVmaXgiOiAiMTIzIgp9",
86
+ * });
87
+ * const serviceSecret = new docker.Secret("service_secret", {
88
+ * name: "tftest-mysecret",
89
+ * data: "ewogICJrZXkiOiAiUVdFUlRZIgp9",
90
+ * });
91
+ * const testNetwork = new docker.Network("test_network", {
92
+ * name: "tftest-network",
93
+ * driver: "overlay",
94
+ * });
95
+ * const foo = new docker.Service("foo", {
96
+ * name: "tftest-service-basic",
97
+ * taskSpec: {
98
+ * containerSpec: {
99
+ * configs: [
100
+ * {
101
+ * configId: serviceConfig.id,
102
+ * configName: serviceConfig.name,
103
+ * fileName: "/configs.json",
104
+ * },
105
+ * {},
106
+ * ],
107
+ * secrets: [
108
+ * {
109
+ * secretId: serviceSecret.id,
110
+ * secretName: serviceSecret.name,
111
+ * fileName: "/secrets.json",
112
+ * fileUid: "0",
113
+ * fileGid: "0",
114
+ * fileMode: 777,
115
+ * },
116
+ * {},
117
+ * ],
118
+ * image: "repo.mycompany.com:8080/foo-service:v1",
119
+ * labels: [{
120
+ * label: "foo.bar",
121
+ * value: "baz",
122
+ * }],
123
+ * commands: ["ls"],
124
+ * args: ["-las"],
125
+ * hostname: "my-fancy-service",
126
+ * env: {
127
+ * MYFOO: "BAR",
128
+ * },
129
+ * dir: "/root",
130
+ * user: "root",
131
+ * groups: [
132
+ * "docker",
133
+ * "foogroup",
134
+ * ],
135
+ * privileges: {
136
+ * seLinuxContext: {
137
+ * disable: true,
138
+ * user: "user-label",
139
+ * role: "role-label",
140
+ * type: "type-label",
141
+ * level: "level-label",
142
+ * },
143
+ * },
144
+ * readOnly: true,
145
+ * mounts: [
146
+ * {
147
+ * target: "/mount/test",
148
+ * source: testVolume.name,
149
+ * type: "bind",
150
+ * readOnly: true,
151
+ * bindOptions: {
152
+ * propagation: "rprivate",
153
+ * },
154
+ * },
155
+ * {
156
+ * target: "/mount/test2",
157
+ * source: testVolume2.name,
158
+ * type: "volume",
159
+ * readOnly: true,
160
+ * volumeOptions: {
161
+ * noCopy: true,
162
+ * labels: [{
163
+ * label: "foo",
164
+ * value: "bar",
165
+ * }],
166
+ * driverName: "random-driver",
167
+ * driverOptions: {
168
+ * op1: "val1",
169
+ * },
170
+ * },
171
+ * },
172
+ * ],
173
+ * stopSignal: "SIGTERM",
174
+ * stopGracePeriod: "10s",
175
+ * healthcheck: {
176
+ * tests: [
177
+ * "CMD",
178
+ * "curl",
179
+ * "-f",
180
+ * "http://localhost:8080/health",
181
+ * ],
182
+ * interval: "5s",
183
+ * timeout: "2s",
184
+ * retries: 4,
185
+ * },
186
+ * hosts: [{
187
+ * host: "testhost",
188
+ * ip: "10.0.1.0",
189
+ * }],
190
+ * dnsConfig: {
191
+ * nameservers: ["8.8.8.8"],
192
+ * searches: ["example.org"],
193
+ * options: ["timeout:3"],
194
+ * },
195
+ * },
196
+ * resources: {
197
+ * limits: {
198
+ * nanoCpus: 1000000,
199
+ * memoryBytes: 536870912,
200
+ * },
201
+ * reservation: {
202
+ * nanoCpus: 1000000,
203
+ * memoryBytes: 536870912,
204
+ * genericResources: {
205
+ * namedResourcesSpecs: ["GPU=UUID1"],
206
+ * discreteResourcesSpecs: ["SSD=3"],
207
+ * },
208
+ * },
209
+ * },
210
+ * restartPolicy: {
211
+ * condition: "on-failure",
212
+ * delay: "3s",
213
+ * maxAttempts: 4,
214
+ * window: "10s",
215
+ * }[0],
216
+ * placement: {
217
+ * constraints: ["node.role==manager"],
218
+ * prefs: ["spread=node.role.manager"],
219
+ * maxReplicas: 1,
220
+ * },
221
+ * forceUpdate: 0,
222
+ * runtime: "container",
223
+ * networks: [testNetwork.id],
224
+ * logDriver: {
225
+ * name: "json-file",
226
+ * options: {
227
+ * "max-size": "10m",
228
+ * "max-file": "3",
229
+ * },
230
+ * },
231
+ * },
232
+ * mode: {
233
+ * replicated: {
234
+ * replicas: 2,
235
+ * },
236
+ * },
237
+ * updateConfig: {
238
+ * parallelism: 2,
239
+ * delay: "10s",
240
+ * failureAction: "pause",
241
+ * monitor: "5s",
242
+ * maxFailureRatio: "0.1",
243
+ * order: "start-first",
244
+ * },
245
+ * rollbackConfig: {
246
+ * parallelism: 2,
247
+ * delay: "5ms",
248
+ * failureAction: "pause",
249
+ * monitor: "10h",
250
+ * maxFailureRatio: "0.9",
251
+ * order: "stop-first",
252
+ * },
253
+ * endpointSpec: {
254
+ * ports: [
255
+ * {
256
+ * name: "random",
257
+ * protocol: "tcp",
258
+ * targetPort: 8080,
259
+ * publishedPort: 8080,
260
+ * publishMode: "ingress",
261
+ * },
262
+ * {},
263
+ * ],
264
+ * mode: "vip",
265
+ * },
266
+ * });
267
+ * ```
40
268
  *
41
- * endpoint_spec {
269
+ * ## Import
42
270
  *
43
- * ports {
271
+ * !/bin/bash
44
272
  *
45
- * target_port = "80"
273
+ * ```sh
274
+ * $ pulumi import docker:index/service:Service foo id
275
+ * ```
46
276
  *
47
- * published_port = "8080"
277
+ * ### Example
278
+ *
279
+ * Assuming you created a `service` as follows
280
+ *
281
+ * ```sh
282
+ * #!/bin/bash
283
+ * docker service create --name foo -p 8080:80 nginx
284
+ * # prints th ID
285
+ * 4pcphbxkfn2rffhbhe6czytgi
286
+ * ```
48
287
  *
49
- * }
288
+ * you provide the definition for the resource as follows
50
289
  *
51
- * }
290
+ * ```typescript
291
+ * import * as pulumi from "@pulumi/pulumi";
292
+ * import * as docker from "@pulumi/docker";
52
293
  *
53
- * }
294
+ * const foo = new docker.Service("foo", {
295
+ * name: "foo",
296
+ * taskSpec: {
297
+ * containerSpec: {
298
+ * image: "nginx",
299
+ * },
300
+ * },
301
+ * endpointSpec: {
302
+ * ports: [{
303
+ * targetPort: 80,
304
+ * publishedPort: 8080,
305
+ * }],
306
+ * },
307
+ * });
308
+ * ```
54
309
  *
55
310
  * then the import command is as follows
56
311
  *
57
- * #!/bin/bash
312
+ * !/bin/bash
58
313
  *
59
314
  * ```sh
60
315
  * $ pulumi import docker:index/service:Service foo 4pcphbxkfn2rffhbhe6czytgi
package/service.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../service.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF;;;AAEjF,yCAAyC;AAIzC,yCAAyC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAa,OAAQ,SAAQ,MAAM,CAAC,cAAc;IAC9C;;;;;;;;OAQG;IACI,MAAM,CAAC,GAAG,CAAC,IAAY,EAAE,EAA2B,EAAE,KAAoB,EAAE,IAAmC;QAClH,OAAO,IAAI,OAAO,CAAC,IAAI,EAAO,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;IAKD;;;OAGG;IACI,MAAM,CAAC,UAAU,C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AAG,WAAsC,CAAC;YACpD,IAAI,IAAI,EAAE,QAAQ,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC3C,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;aAC3D;YACD,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC;YACpC,cAAc,CAAC,gBAAgB,CAAC,GAAG,IAAI,EAAE,cAAc,CAAC;YACxD,cAAc,CAAC,cAAc,CAAC,GAAG,IAAI,EAAE,YAAY,CAAC;YACpD,cAAc,CAAC,QAAQ,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC;YACxC,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC;YACpC,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC;YACpC,cAAc,CAAC,gBAAgB,CAAC,GAAG,IAAI,EAAE,cAAc,CAAC;YACxD,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,EAAE,QAAQ,CAAC;YAC5C,cAAc,CAAC,cAAc,CAAC,GAAG,IAAI,EAAE,YAAY,CAAC;SACvD;QACD,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,oBAAoB,EAAE,EAAE,IAAI,CAAC,CAAC;QACnE,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IAC5D,CAAC;;AAxGL,0BAyGC;AA3FG,gBAAgB;AACO,oBAAY,GAAG,8BAA8B,CAAC"}
@@ -1,34 +1,54 @@
1
1
  import * as pulumi from "@pulumi/pulumi";
2
2
  /**
3
- * ## Import
3
+ * <!-- Bug: Type and Name are switched -->
4
+ * Manages the configs of a Docker service in a swarm.
4
5
  *
5
- * ### Example
6
+ * ## Example Usage
6
7
  *
7
- * Assuming you created a `config` as follows
8
+ * ### Basic
8
9
  *
9
- * #!/bin/bash
10
+ * ### Advanced
11
+ * ### Dynamically set config with a template
12
+ * In this example you can use the `${var.foo_port}` variable to dynamically
13
+ * set the `${port}` variable in the `foo.configs.json.tpl` template and create
14
+ * the data of the `fooConfig` with the help of the `base64encode` interpolation
15
+ * function.
10
16
  *
11
- * printf '{"a":"b"}' | docker config create foo -
17
+ * The file `foo.config.json.tpl` has the following content:
12
18
  *
13
- * prints the id
19
+ * and the resource uses it as follows:
14
20
  *
15
- * 08c26c477474478d971139f750984775a7f019dbe8a2e7f09d66a187c009e66d
21
+ * ### Update config with no downtime
22
+ * To update a `config`, Terraform will destroy the existing resource and create a replacement.
23
+ * To effectively use a `docker.ServiceConfig` resource with a `docker.Service` resource, it's recommended
24
+ * to specify `createBeforeDestroy` in a `lifecycle` block. Provide a unique `name` attribute,
25
+ * for example with one of the interpolation functions `uuid` or `timestamp` as shown
26
+ * in the example below. The reason is this [issue](https://github.com/moby/moby/issues/35803).
16
27
  *
17
- * you provide the definition for the resource as follows
28
+ * ## Import
18
29
  *
19
- * terraform
30
+ * !/bin/bash
31
+ *
32
+ * ```sh
33
+ * $ pulumi import docker:index/serviceConfig:ServiceConfig foo id
34
+ * ```
20
35
  *
21
- * resource "docker_config" "foo" {
36
+ * ### Example
22
37
  *
23
- * name = "foo"
38
+ * Assuming you created a `config` as follows
24
39
  *
25
- * data = base64encode("{\"a\": \"b\"}")
40
+ * ```sh
41
+ * #!/bin/bash
42
+ * printf '{"a":"b"}' | docker config create foo -
43
+ * # prints the id
44
+ * 08c26c477474478d971139f750984775a7f019dbe8a2e7f09d66a187c009e66d
45
+ * ```
26
46
  *
27
- * }
47
+ * you provide the definition for the resource as follows
28
48
  *
29
49
  * then the import command is as follows
30
50
  *
31
- * #!/bin/bash
51
+ * !/bin/bash
32
52
  *
33
53
  * ```sh
34
54
  * $ pulumi import docker:index/serviceConfig:ServiceConfig foo 08c26c477474478d971139f750984775a7f019dbe8a2e7f09d66a187c009e66d
package/serviceConfig.js CHANGED
@@ -6,35 +6,55 @@ exports.ServiceConfig = void 0;
6
6
  const pulumi = require("@pulumi/pulumi");
7
7
  const utilities = require("./utilities");
8
8
  /**
9
- * ## Import
9
+ * <!-- Bug: Type and Name are switched -->
10
+ * Manages the configs of a Docker service in a swarm.
10
11
  *
11
- * ### Example
12
+ * ## Example Usage
12
13
  *
13
- * Assuming you created a `config` as follows
14
+ * ### Basic
14
15
  *
15
- * #!/bin/bash
16
+ * ### Advanced
17
+ * ### Dynamically set config with a template
18
+ * In this example you can use the `${var.foo_port}` variable to dynamically
19
+ * set the `${port}` variable in the `foo.configs.json.tpl` template and create
20
+ * the data of the `fooConfig` with the help of the `base64encode` interpolation
21
+ * function.
16
22
  *
17
- * printf '{"a":"b"}' | docker config create foo -
23
+ * The file `foo.config.json.tpl` has the following content:
18
24
  *
19
- * prints the id
25
+ * and the resource uses it as follows:
20
26
  *
21
- * 08c26c477474478d971139f750984775a7f019dbe8a2e7f09d66a187c009e66d
27
+ * ### Update config with no downtime
28
+ * To update a `config`, Terraform will destroy the existing resource and create a replacement.
29
+ * To effectively use a `docker.ServiceConfig` resource with a `docker.Service` resource, it's recommended
30
+ * to specify `createBeforeDestroy` in a `lifecycle` block. Provide a unique `name` attribute,
31
+ * for example with one of the interpolation functions `uuid` or `timestamp` as shown
32
+ * in the example below. The reason is this [issue](https://github.com/moby/moby/issues/35803).
22
33
  *
23
- * you provide the definition for the resource as follows
34
+ * ## Import
24
35
  *
25
- * terraform
36
+ * !/bin/bash
37
+ *
38
+ * ```sh
39
+ * $ pulumi import docker:index/serviceConfig:ServiceConfig foo id
40
+ * ```
26
41
  *
27
- * resource "docker_config" "foo" {
42
+ * ### Example
28
43
  *
29
- * name = "foo"
44
+ * Assuming you created a `config` as follows
30
45
  *
31
- * data = base64encode("{\"a\": \"b\"}")
46
+ * ```sh
47
+ * #!/bin/bash
48
+ * printf '{"a":"b"}' | docker config create foo -
49
+ * # prints the id
50
+ * 08c26c477474478d971139f750984775a7f019dbe8a2e7f09d66a187c009e66d
51
+ * ```
32
52
  *
33
- * }
53
+ * you provide the definition for the resource as follows
34
54
  *
35
55
  * then the import command is as follows
36
56
  *
37
- * #!/bin/bash
57
+ * !/bin/bash
38
58
  *
39
59
  * ```sh
40
60
  * $ pulumi import docker:index/serviceConfig:ServiceConfig foo 08c26c477474478d971139f750984775a7f019dbe8a2e7f09d66a187c009e66d
@@ -1 +1 @@
1
- {"version":3,"file":"serviceConfig.js","sourceRoot":"","sources":["../serviceConfig.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF;;;AAEjF,yCAAyC;AACzC,yCAAyC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAa,aAAc,SAAQ,MAAM,CAAC,cAAc;IACpD;;;;;;;;OAQG;IACI,MAAM,CAAC,GAAG,CAAC,IAAY,EAAE,EAA2B,EAAE,KAA0B,EAAE,IAAmC;QACxH,OAAO,IAAI,aAAa,CAAC,IAAI,EAAO,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IAKD;;;OAGG;IACI,MAAM,CAAC,UAAU,CAAC,GAAQ;QAC7B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE;YACnC,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,GAAG,CAAC,cAAc,CAAC,KAAK,aAAa,CAAC,YAAY,CAAC;IAC9D,CAAC;IAmBD,YAAY,IAAY,EAAE,WAAoD,EAAE,IAAmC;QAC/G,IAAI,cAAc,GAAkB,EAAE,CAAC;QACvC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAClB,IAAI,IAAI,CAAC,EAAE,EAAE;YACT,MAAM,KAAK,GAAG,WAA6C,CAAC;YAC5D,cAAc,CAAC,MAAM,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC;YACrC,cAAc,CAAC,MAAM,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC;SACxC;aAAM;YACH,MAAM,IAAI,GAAG,W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AAY,IAAY,EAAE,WAAoD,EAAE,IAAmC;QAC/G,IAAI,cAAc,GAAkB,EAAE,CAAC;QACvC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAClB,IAAI,IAAI,CAAC,EAAE,EAAE;YACT,MAAM,KAAK,GAAG,WAA6C,CAAC;YAC5D,cAAc,CAAC,MAAM,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC;YACrC,cAAc,CAAC,MAAM,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC;SACxC;aAAM;YACH,MAAM,IAAI,GAAG,WAA4C,CAAC;YAC1D,IAAI,IAAI,EAAE,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;gBACvC,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;aACvD;YACD,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC;YACpC,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC;SACvC;QACD,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,oBAAoB,EAAE,EAAE,IAAI,CAAC,CAAC;QACnE,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;;AA9DL,sCA+DC;AAjDG,gBAAgB;AACO,0BAAY,GAAG,0CAA0C,CAAC"}
package/types/input.d.ts CHANGED
@@ -598,6 +598,9 @@ export interface ProviderRegistryAuth {
598
598
  * Address of the registry
599
599
  */
600
600
  address: pulumi.Input<string>;
601
+ /**
602
+ * Setting this to `true` will tell the provider that this registry does not need authentication. Due to the docker internals, the provider will use dummy credentials (see https://github.com/kreuzwerker/terraform-provider-docker/issues/470 for more information). Defaults to `false`.
603
+ */
601
604
  authDisabled?: pulumi.Input<boolean>;
602
605
  /**
603
606
  * Path to docker json file for registry auth. Defaults to `~/.docker/config.json`. If `DOCKER_CONFIG` is set, the value of `DOCKER_CONFIG` is used as the path. `configFile` has predencen over all other options.
package/types/output.d.ts CHANGED
@@ -1705,6 +1705,9 @@ export declare namespace config {
1705
1705
  * Address of the registry
1706
1706
  */
1707
1707
  address: string;
1708
+ /**
1709
+ * Setting this to `true` will tell the provider that this registry does not need authentication. Due to the docker internals, the provider will use dummy credentials (see https://github.com/kreuzwerker/terraform-provider-docker/issues/470 for more information). Defaults to `false`.
1710
+ */
1708
1711
  authDisabled?: boolean;
1709
1712
  /**
1710
1713
  * Path to docker json file for registry auth. Defaults to `~/.docker/config.json`. If `DOCKER_CONFIG` is set, the value of `DOCKER_CONFIG` is used as the path. `configFile` has predencen over all other options.
package/volume.d.ts CHANGED
@@ -16,31 +16,35 @@ import * as outputs from "./types/output";
16
16
  *
17
17
  * ## Import
18
18
  *
19
+ * !/bin/bash
20
+ *
21
+ * ```sh
22
+ * $ pulumi import docker:index/volume:Volume foo id
23
+ * ```
24
+ *
19
25
  * ### Example
20
26
  *
21
27
  * Assuming you created a `volume` as follows
22
28
  *
29
+ * ```sh
23
30
  * #!/bin/bash
24
- *
25
31
  * docker volume create
26
- *
27
- * prints the long ID
28
- *
32
+ * # prints the long ID
29
33
  * 524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d
34
+ * ```
30
35
  *
31
36
  * you provide the definition for the resource as follows
32
37
  *
33
- * terraform
34
- *
35
- * resource "docker_volume" "foo" {
36
- *
37
- * name = "524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d"
38
+ * ```typescript
39
+ * import * as pulumi from "@pulumi/pulumi";
40
+ * import * as docker from "@pulumi/docker";
38
41
  *
39
- * }
42
+ * const foo = new docker.Volume("foo", {name: "524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d"});
43
+ * ```
40
44
  *
41
45
  * then the import command is as follows
42
46
  *
43
- * #!/bin/bash
47
+ * !/bin/bash
44
48
  *
45
49
  * ```sh
46
50
  * $ pulumi import docker:index/volume:Volume foo 524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d
package/volume.js CHANGED
@@ -20,31 +20,35 @@ const utilities = require("./utilities");
20
20
  *
21
21
  * ## Import
22
22
  *
23
+ * !/bin/bash
24
+ *
25
+ * ```sh
26
+ * $ pulumi import docker:index/volume:Volume foo id
27
+ * ```
28
+ *
23
29
  * ### Example
24
30
  *
25
31
  * Assuming you created a `volume` as follows
26
32
  *
33
+ * ```sh
27
34
  * #!/bin/bash
28
- *
29
35
  * docker volume create
30
- *
31
- * prints the long ID
32
- *
36
+ * # prints the long ID
33
37
  * 524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d
38
+ * ```
34
39
  *
35
40
  * you provide the definition for the resource as follows
36
41
  *
37
- * terraform
38
- *
39
- * resource "docker_volume" "foo" {
40
- *
41
- * name = "524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d"
42
+ * ```typescript
43
+ * import * as pulumi from "@pulumi/pulumi";
44
+ * import * as docker from "@pulumi/docker";
42
45
  *
43
- * }
46
+ * const foo = new docker.Volume("foo", {name: "524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d"});
47
+ * ```
44
48
  *
45
49
  * then the import command is as follows
46
50
  *
47
- * #!/bin/bash
51
+ * !/bin/bash
48
52
  *
49
53
  * ```sh
50
54
  * $ pulumi import docker:index/volume:Volume foo 524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d
package/volume.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"volume.js","sourceRoot":"","sources":["../volume.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF;;;AAEjF,yCAAyC;AAIzC,yCAAyC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAa,MAAO,SAAQ,MAAM,CAAC,cAAc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