Skip to content

Commit 0914cce

Browse files
documentation for agent registry
1 parent 11524e2 commit 0914cce

2 files changed

Lines changed: 188 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ BREAKING CHANGES:
66

77
FEATURES:
88

9+
* **New Resource**: `vault_agent_registration` for managing agent registrations in Vault Enterprise. Allows registering Vault agents with specific identity entities and configuring ceiling policies that limit maximum agent permissions. Requires Vault 2.0.0+.
910
* **New Resources**: `vault_rotation_policy` for managing rotation policies. Requires Vault 2.0.0+. ([#2844](https://github.com/hashicorp/terraform-provider-vault/pull/2844))
1011
* Add support for `vault_quota_config` resource. ([#2837](https://github.com/hashicorp/terraform-provider-vault/pull/2837))
1112
* **New Resources**: Add support for Vault Key Management secrets engine with resources for managing KMS providers (AWS KMS, Azure Key Vault, GCP Cloud KMS), cryptographic keys, key distribution, replication, and rotation (Vault Enterprise). ([#2802](https://github.com/hashicorp/terraform-provider-vault/pull/2802))
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
---
2+
layout: "vault"
3+
page_title: "Vault: vault_agent_registration resource"
4+
sidebar_current: "docs-vault-resource-sys-agent-registration"
5+
description: |-
6+
Manages agent registrations in Vault Enterprise.
7+
---
8+
9+
# vault\_agent\_registration
10+
11+
Manages agent registrations in Vault Enterprise. Agent registration allows you to register Vault agents with specific identity entities and configure ceiling policies that limit the maximum permissions an agent can obtain.
12+
13+
~> **Important** This resource is only available in Vault Enterprise and requires Vault 2.0.0 or later.
14+
15+
## Example Usage
16+
17+
### Basic Agent Registration
18+
19+
```hcl
20+
resource "vault_identity_entity" "agent" {
21+
name = "my-agent-entity"
22+
policies = ["default"]
23+
}
24+
25+
resource "vault_agent_registration" "example" {
26+
display_name = "my-agent"
27+
entity_id = vault_identity_entity.agent.id
28+
}
29+
```
30+
31+
### Agent Registration with Ceiling Policies
32+
33+
```hcl
34+
resource "vault_policy" "agent_ceiling" {
35+
name = "agent-ceiling-policy"
36+
policy = <<EOT
37+
path "secret/data/*" {
38+
capabilities = ["read"]
39+
}
40+
41+
path "auth/token/renew-self" {
42+
capabilities = ["update"]
43+
}
44+
EOT
45+
}
46+
47+
resource "vault_identity_entity" "agent" {
48+
name = "my-agent-entity"
49+
policies = ["default"]
50+
}
51+
52+
resource "vault_agent_registration" "example" {
53+
display_name = "my-agent"
54+
entity_id = vault_identity_entity.agent.id
55+
ceiling_policy_identifiers = [vault_policy.agent_ceiling.name]
56+
description = "Production agent for application X"
57+
}
58+
```
59+
60+
### Agent Registration Without Default Ceiling Policy
61+
62+
```hcl
63+
resource "vault_identity_entity" "agent" {
64+
name = "my-agent-entity"
65+
}
66+
67+
resource "vault_agent_registration" "example" {
68+
display_name = "my-agent"
69+
entity_id = vault_identity_entity.agent.id
70+
no_default_ceiling_policy = true
71+
}
72+
```
73+
74+
### Agent Registration in a Namespace
75+
76+
```hcl
77+
resource "vault_namespace" "app" {
78+
path = "application"
79+
}
80+
81+
resource "vault_identity_entity" "agent" {
82+
namespace = vault_namespace.app.path
83+
name = "my-agent-entity"
84+
policies = ["default"]
85+
}
86+
87+
resource "vault_agent_registration" "example" {
88+
namespace = vault_namespace.app.path
89+
display_name = "my-agent"
90+
entity_id = vault_identity_entity.agent.id
91+
}
92+
```
93+
94+
### Agent Registration with Multiple Ceiling Policies
95+
96+
```hcl
97+
resource "vault_policy" "secrets_read" {
98+
name = "secrets-read"
99+
policy = <<EOT
100+
path "secret/data/*" {
101+
capabilities = ["read"]
102+
}
103+
EOT
104+
}
105+
106+
resource "vault_policy" "auth_renew" {
107+
name = "auth-renew"
108+
policy = <<EOT
109+
path "auth/token/renew-self" {
110+
capabilities = ["update"]
111+
}
112+
EOT
113+
}
114+
115+
resource "vault_identity_entity" "agent" {
116+
name = "my-agent-entity"
117+
policies = ["default"]
118+
}
119+
120+
resource "vault_agent_registration" "example" {
121+
display_name = "my-agent"
122+
entity_id = vault_identity_entity.agent.id
123+
ceiling_policy_identifiers = [
124+
vault_policy.secrets_read.name,
125+
vault_policy.auth_renew.name,
126+
]
127+
}
128+
```
129+
130+
## Argument Reference
131+
132+
The following arguments are supported:
133+
134+
* `namespace` - (Optional) The namespace to provision the resource in.
135+
The value should not contain leading or trailing forward slashes.
136+
The `namespace` is always relative to the provider's configured [namespace](/docs/providers/vault/index.html#namespace).
137+
*Available only for Vault Enterprise*.
138+
139+
* `display_name` - (Required) The display name for the agent registration. This is used as the unique identifier for the agent. Changing this will force a new resource to be created.
140+
141+
* `entity_id` - (Required) The ID of the identity entity to associate with this agent registration. The entity must exist before creating the agent registration.
142+
143+
* `ceiling_policy_identifiers` - (Optional) A list of policy names that define the maximum permissions this agent can obtain. These policies act as a ceiling - the agent cannot obtain permissions beyond what these policies allow, even if the entity or token policies would grant more permissions. By default, Vault applies a default ceiling policy unless `no_default_ceiling_policy` is set to `true`.
144+
145+
* `no_default_ceiling_policy` - (Optional) When set to `true`, prevents Vault from applying the default ceiling policy to this agent. This allows you to have complete control over the agent's ceiling policies. Defaults to `false`.
146+
147+
* `description` - (Optional) A human-readable description of the agent registration. This field is for documentation purposes and does not affect the agent's behavior.
148+
149+
## Attributes Reference
150+
151+
In addition to the arguments above, the following attributes are exported:
152+
153+
* `id` - The unique identifier for the agent registration. This is a GUID-like identifier automatically generated by Vault.
154+
155+
* `creation_time` - The timestamp when the agent registration was created, in RFC3339 format.
156+
157+
* `last_updated_time` - The timestamp when the agent registration was last updated, in RFC3339 format.
158+
159+
## Import
160+
161+
Agent registrations can be imported using the `display_name`, e.g.
162+
163+
```
164+
$ terraform import vault_agent_registration.example my-agent
165+
```
166+
167+
For agent registrations in a namespace, use the format `namespace/display_name`:
168+
169+
```
170+
$ terraform import vault_agent_registration.example application/my-agent
171+
```
172+
173+
## Notes
174+
175+
* **Ceiling Policies**: Ceiling policies define the maximum permissions an agent can obtain. Even if the associated entity or token policies grant broader permissions, the agent will be limited to the intersection of all applicable policies and the ceiling policies.
176+
177+
* **Default Ceiling Policy**: By default, Vault applies a default ceiling policy to agent registrations. This policy is automatically filtered out when reading the resource state, so only user-specified ceiling policies appear in the `ceiling_policy_identifiers` attribute.
178+
179+
* **Entity Requirement**: The identity entity specified in `entity_id` must exist before creating the agent registration. The entity defines the base identity for the agent.
180+
181+
* **Display Name Uniqueness**: The `display_name` must be unique within the namespace. Attempting to create multiple agent registrations with the same display name will result in an error.
182+
183+
* **Immutable Display Name**: Changing the `display_name` requires destroying and recreating the agent registration, as it serves as the unique identifier.
184+
185+
* **Enterprise Feature**: Agent registration is only available in Vault Enterprise. Attempting to use this resource with Vault Community Edition will result in an error.
186+
187+
* **Version Requirement**: This resource requires Vault 1.18.0 or later.

0 commit comments

Comments
 (0)