mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-20 22:59:42 -05:00
* chore: runs v2 upgrade cmd * chore: moves all files into the internal provider dir * feat: migrates main and provider * fix: migrates tests to provider factories * fix: replace import state passthrough ctx func * chore: bump tf-sdk to v2.4.4 * fix: acc test by adding stop grace period * fix: move to validate diag functions * test: switch from ctx TODO to Background * feat: add state upgrade for restart_policy and auth Co-authored-by: Shunsuke Suzuki <suzuki-shunsuke@users.noreply.github.com>
131 lines
3.2 KiB
Go
131 lines
3.2 KiB
Go
package provider
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
)
|
|
|
|
func resourceDockerImage() *schema.Resource {
|
|
return &schema.Resource{
|
|
CreateContext: resourceDockerImageCreate,
|
|
ReadContext: resourceDockerImageRead,
|
|
UpdateContext: resourceDockerImageUpdate,
|
|
DeleteContext: resourceDockerImageDelete,
|
|
|
|
Schema: map[string]*schema.Schema{
|
|
"name": {
|
|
Type: schema.TypeString,
|
|
Required: true,
|
|
},
|
|
|
|
"latest": {
|
|
Type: schema.TypeString,
|
|
Computed: true,
|
|
},
|
|
|
|
"keep_locally": {
|
|
Type: schema.TypeBool,
|
|
Optional: true,
|
|
},
|
|
|
|
"pull_trigger": {
|
|
Type: schema.TypeString,
|
|
Optional: true,
|
|
ForceNew: true,
|
|
ConflictsWith: []string{"pull_triggers"},
|
|
Deprecated: "Use field pull_triggers instead",
|
|
},
|
|
|
|
"pull_triggers": {
|
|
Type: schema.TypeSet,
|
|
Optional: true,
|
|
ForceNew: true,
|
|
Elem: &schema.Schema{Type: schema.TypeString},
|
|
Set: schema.HashString,
|
|
},
|
|
|
|
"output": {
|
|
Type: schema.TypeString,
|
|
Computed: true,
|
|
Elem: &schema.Schema{
|
|
Type: schema.TypeString,
|
|
},
|
|
},
|
|
|
|
"force_remove": {
|
|
Type: schema.TypeBool,
|
|
Description: "Force remove the image when the resource is destroyed",
|
|
Optional: true,
|
|
},
|
|
|
|
"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,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|