mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-23 08:09:37 -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>
95 lines
2.5 KiB
Go
95 lines
2.5 KiB
Go
package provider
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
)
|
|
|
|
func resourceDockerPlugin() *schema.Resource {
|
|
return &schema.Resource{
|
|
Create: resourceDockerPluginCreate,
|
|
Read: resourceDockerPluginRead,
|
|
Update: resourceDockerPluginUpdate,
|
|
Delete: resourceDockerPluginDelete,
|
|
Importer: &schema.ResourceImporter{
|
|
StateContext: schema.ImportStatePassthroughContext,
|
|
},
|
|
Schema: map[string]*schema.Schema{
|
|
"name": {
|
|
Type: schema.TypeString,
|
|
Required: true,
|
|
ForceNew: true,
|
|
Description: "Docker Plugin name",
|
|
DiffSuppressFunc: diffSuppressFuncPluginName,
|
|
ValidateFunc: validateFuncPluginName,
|
|
},
|
|
"alias": {
|
|
Type: schema.TypeString,
|
|
Computed: true,
|
|
Optional: true,
|
|
ForceNew: true,
|
|
Description: "Docker Plugin alias",
|
|
DiffSuppressFunc: func(k, oldV, newV string, d *schema.ResourceData) bool {
|
|
return complementTag(oldV) == complementTag(newV)
|
|
},
|
|
},
|
|
"enabled": {
|
|
Type: schema.TypeBool,
|
|
Optional: true,
|
|
Default: true,
|
|
},
|
|
"grant_all_permissions": {
|
|
Type: schema.TypeBool,
|
|
Optional: true,
|
|
Description: "If true, grant all permissions necessary to run the plugin",
|
|
ConflictsWith: []string{"grant_permissions"},
|
|
},
|
|
"grant_permissions": {
|
|
Type: schema.TypeSet,
|
|
Optional: true,
|
|
ConflictsWith: []string{"grant_all_permissions"},
|
|
Set: dockerPluginGrantPermissionsSetFunc,
|
|
Elem: &schema.Resource{
|
|
Schema: map[string]*schema.Schema{
|
|
"name": {
|
|
Type: schema.TypeString,
|
|
Required: true,
|
|
},
|
|
"value": {
|
|
Type: schema.TypeSet,
|
|
Required: true,
|
|
Elem: &schema.Schema{
|
|
Type: schema.TypeString,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
"env": {
|
|
Type: schema.TypeSet,
|
|
Optional: true,
|
|
Computed: true,
|
|
Elem: &schema.Schema{Type: schema.TypeString},
|
|
},
|
|
"plugin_reference": {
|
|
Type: schema.TypeString,
|
|
Description: "Docker Plugin Reference",
|
|
Computed: true,
|
|
},
|
|
|
|
"force_destroy": {
|
|
Type: schema.TypeBool,
|
|
Optional: true,
|
|
},
|
|
"enable_timeout": {
|
|
Type: schema.TypeInt,
|
|
Optional: true,
|
|
Description: "HTTP client timeout to enable the plugin",
|
|
},
|
|
"force_disable": {
|
|
Type: schema.TypeBool,
|
|
Optional: true,
|
|
Description: "If true, then the plugin is disabled forcibly when the plugin is disabled",
|
|
},
|
|
},
|
|
}
|
|
}
|