open-consul/website/content/commands/config/delete.mdx
cskh 2d99304762
feat(cli): enable to delete config entry from an input file (#13677)
* feat(cli): enable to delete config entry from an input file

- A new flag to config delete to delete a config entry in a
  valid config file, e.g., config delete -filename
  intention-allow.hcl
- Updated flag validation; -filename and -kind can't be set
  at the same time
- Move decode config entry method from config_write.go to
  helpers.go for reusing ParseConfigEntry()
- add changelog

Co-authored-by: Dan Upton <daniel@floppy.co>
2022-07-11 10:13:40 -04:00

74 lines
2.5 KiB
Plaintext

---
layout: commands
page_title: 'Commands: Config Delete'
---
# Consul Config Delete
Command: `consul config delete`
Corresponding HTTP API Endpoint: [\[DELETE\] /v1/config/:kind/:name](/api-docs/config#delete-configuration)
The `config delete` command deletes the configuration entry specified by the
kind and name. See the [configuration entries docs](/docs/agent/config-entries)
for more details about configuration entries.
The table below shows this command's [required ACLs](/api#authentication). Configuration of
[blocking queries](/api-docs/features/blocking) and [agent caching](/api-docs/features/caching)
are not supported from commands, but may be from the corresponding HTTP endpoint.
| ACL Required<sup>1</sup> |
| ------------------------------------------------------------- |
| `service:write`<br />`operator:write`<br />`intentions:write` |
<sup>1</sup> The ACL required depends on the config entry kind being deleted:
| Config Entry Kind | Required ACL |
| ------------------- | ------------------ |
| ingress-gateway | `operator:write` |
| proxy-defaults | `operator:write` |
| service-defaults | `service:write` |
| service-intentions | `intentions:write` |
| service-resolver | `service:write` |
| service-router | `service:write` |
| service-splitter | `service:write` |
| terminating-gateway | `operator:write ` |
## Usage
Usage: `consul config delete [options]`
#### API Options
@include 'http_api_options_client.mdx'
#### Enterprise Options
@include 'http_api_namespace_options.mdx'
@include 'http_api_partition_options.mdx'
#### Config Delete Options
- `-kind` - Specifies the kind of the config entry to read.
- `-name` - Specifies the name of the config entry to delete. The name of the
`proxy-defaults` config entry must be `global`, and the name of the `mesh`
config entry must be `mesh`.
- `-filename` - Specifies the file describing the config entry to delete.
- `-cas` - Perform a Check-And-Set operation. Specifying this value also
requires the -modify-index flag to be set. The default value is false.
- `-modify-index=<int>` - Unsigned integer representing the ModifyIndex of the
config entry. This is used in combination with the -cas flag.
## Examples
$ consul config delete -kind service-defaults -name web
$ consul config delete -kind service-defaults -name web -cas -modify-index 26
$ consul config delete -filename service-defaults-web.hcl