2015-02-17 11:28:33 -05:00
|
|
|
package docker
|
|
|
|
|
|
|
|
|
|
import (
|
2019-10-09 14:25:38 -04:00
|
|
|
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
2015-02-17 11:28:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func resourceDockerImage() *schema.Resource {
|
|
|
|
|
return &schema.Resource{
|
|
|
|
|
Create: resourceDockerImageCreate,
|
|
|
|
|
Read: resourceDockerImageRead,
|
|
|
|
|
Update: resourceDockerImageUpdate,
|
|
|
|
|
Delete: resourceDockerImageDelete,
|
|
|
|
|
|
|
|
|
|
Schema: map[string]*schema.Schema{
|
2019-03-01 16:02:17 -05:00
|
|
|
"name": {
|
2015-02-17 11:28:33 -05:00
|
|
|
Type: schema.TypeString,
|
|
|
|
|
Required: true,
|
|
|
|
|
},
|
|
|
|
|
|
2019-03-01 16:02:17 -05:00
|
|
|
"latest": {
|
2015-02-17 11:28:33 -05:00
|
|
|
Type: schema.TypeString,
|
|
|
|
|
Computed: true,
|
|
|
|
|
},
|
2016-04-27 12:18:02 -04:00
|
|
|
|
2019-03-01 16:02:17 -05:00
|
|
|
"keep_locally": {
|
2016-04-27 12:18:02 -04:00
|
|
|
Type: schema.TypeBool,
|
|
|
|
|
Optional: true,
|
|
|
|
|
},
|
2016-07-26 11:18:38 -04:00
|
|
|
|
2019-03-01 16:02:17 -05:00
|
|
|
"pull_trigger": {
|
2017-01-03 11:10:39 -05:00
|
|
|
Type: schema.TypeString,
|
|
|
|
|
Optional: true,
|
|
|
|
|
ForceNew: true,
|
|
|
|
|
ConflictsWith: []string{"pull_triggers"},
|
|
|
|
|
Deprecated: "Use field pull_triggers instead",
|
|
|
|
|
},
|
|
|
|
|
|
2019-03-01 16:02:17 -05:00
|
|
|
"pull_triggers": {
|
2017-01-03 11:10:39 -05:00
|
|
|
Type: schema.TypeSet,
|
2016-07-26 11:18:38 -04:00
|
|
|
Optional: true,
|
|
|
|
|
ForceNew: true,
|
2017-01-03 11:10:39 -05:00
|
|
|
Elem: &schema.Schema{Type: schema.TypeString},
|
|
|
|
|
Set: schema.HashString,
|
2016-07-26 11:18:38 -04:00
|
|
|
},
|
2020-10-07 14:06:13 -04:00
|
|
|
|
|
|
|
|
"output": {
|
|
|
|
|
Type: schema.TypeString,
|
|
|
|
|
Computed: true,
|
|
|
|
|
Elem: &schema.Schema{
|
|
|
|
|
Type: schema.TypeString,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
2020-12-29 02:03:40 -05:00
|
|
|
"force_remove": {
|
|
|
|
|
Type: schema.TypeBool,
|
|
|
|
|
Description: "Force remove the image when the resource is destroyed",
|
|
|
|
|
Optional: true,
|
|
|
|
|
},
|
|
|
|
|
|
2020-10-07 14:06:13 -04:00
|
|
|
"build": {
|
|
|
|
|
Type: schema.TypeSet,
|
|
|
|
|
Optional: true,
|
|
|
|
|
MaxItems: 1,
|
|
|
|
|
ConflictsWith: []string{"pull_triggers", "pull_trigger"},
|
|
|
|
|
Elem: &schema.Resource{
|
|
|
|
|
Schema: map[string]*schema.Schema{
|
|
|
|
|
"path": {
|
|
|
|
|
Type: schema.TypeString,
|
|
|
|
|
Description: "Context path",
|
|
|
|
|
Required: true,
|
|
|
|
|
ForceNew: true,
|
|
|
|
|
},
|
|
|
|
|
"dockerfile": {
|
|
|
|
|
Type: schema.TypeString,
|
|
|
|
|
Description: "Name of the Dockerfile (Default is 'PATH/Dockerfile')",
|
|
|
|
|
Optional: true,
|
|
|
|
|
Default: "Dockerfile",
|
|
|
|
|
ForceNew: true,
|
|
|
|
|
},
|
|
|
|
|
"tag": {
|
|
|
|
|
Type: schema.TypeList,
|
|
|
|
|
Description: "Name and optionally a tag in the 'name:tag' format",
|
|
|
|
|
Optional: true,
|
|
|
|
|
Elem: &schema.Schema{
|
|
|
|
|
Type: schema.TypeString,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
"force_remove": {
|
|
|
|
|
Type: schema.TypeBool,
|
|
|
|
|
Description: "Always remove intermediate containers",
|
|
|
|
|
Optional: true,
|
|
|
|
|
},
|
|
|
|
|
"remove": {
|
|
|
|
|
Type: schema.TypeBool,
|
|
|
|
|
Description: "Remove intermediate containers after a successful build (default true)",
|
|
|
|
|
Default: true,
|
|
|
|
|
Optional: true,
|
|
|
|
|
},
|
|
|
|
|
"no_cache": {
|
|
|
|
|
Type: schema.TypeBool,
|
|
|
|
|
Description: "Do not use cache when building the image",
|
|
|
|
|
Optional: true,
|
|
|
|
|
},
|
|
|
|
|
"target": {
|
|
|
|
|
Type: schema.TypeString,
|
|
|
|
|
Description: "Set the target build stage to build",
|
|
|
|
|
Optional: true,
|
|
|
|
|
},
|
|
|
|
|
"build_arg": {
|
|
|
|
|
Type: schema.TypeMap,
|
|
|
|
|
Description: "Set build-time variables",
|
|
|
|
|
Optional: true,
|
|
|
|
|
Elem: &schema.Schema{
|
|
|
|
|
Type: schema.TypeString,
|
|
|
|
|
},
|
|
|
|
|
ForceNew: true,
|
|
|
|
|
},
|
|
|
|
|
"label": {
|
|
|
|
|
Type: schema.TypeMap,
|
|
|
|
|
Description: "Set metadata for an image",
|
|
|
|
|
Optional: true,
|
|
|
|
|
Elem: &schema.Schema{
|
|
|
|
|
Type: schema.TypeString,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2015-02-17 11:28:33 -05:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|