The portainer_docker_config resource allows you to manage Docker configs within a specific environment (endpoint) in Portainer.
Configs are immutable, and any change will cause them to be re-created.
resource "portainer_docker_config" "example_config" {
endpoint_id = 1
name = "server.conf"
data = base64encode("THIS IS NOT A REAL CERTIFICATE\n")
labels = {
property1 = "string"
property2 = "string"
foo = "bar"
}
templating = {
name = "some-driver"
OptionA = "value for driver-specific option A"
OptionB = "value for driver-specific option B"
}
}Updating them (changing data, labels, etc.) will force recreation.
Terraform will automatically destroy and re-create config on change.
Use terraform destroy to remove the config.
| Name | Type | Required | Description |
|---|---|---|---|
| endpoint_id | int | ✅ yes | ID of the environment (endpoint) in Portainer |
| name | string | ✅ yes | Name of the Docker config |
| data | string | ✅ yes | Base64-encoded string containing the config content |
| labels | map(string) | 🚫 optional | Map of labels to associate with the config |
| templating | map(string) | 🚫 optional | Templating configuration (e.g., name, Options) |
⚠️ Note: Thedatamust be a valid base64-encoded string. Use Terraform'sbase64encode()function if needed.
| Name | Description |
|---|---|
id |
ID of the created Docker config (from Portainer) |
resource_control_id |
ID of the automatically generated Portainer ResourceControl for this config |