TFVP: implement support for Agent Registry#2885
TFVP: implement support for Agent Registry#2885Chris-Paris-HashiCorp wants to merge 5 commits intomainfrom
Conversation
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Chris Paris seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
Agent Registration Resource ImplementationOverviewThis document describes the implementation of the Feature SummaryResource Name:
Implementation DetailsFiles Added
Files Modified
Resource SchemaRequired Fields
Optional Fields
Computed Fields
Key Implementation Features1. Ceiling Policy Management
2. Namespace Support
3. Import Functionality
4. State Management
5. Plan Modifiers
Test CoverageTest Scenarios
Test Patterns
API IntegrationEndpoints Used
Request/Response Handling
Design Decisions1. Display Name as Identifier
2. Policy Filtering
3. Separate API Model
4. Framework Choice
Usage ExamplesBasic Usageresource "vault_identity_entity" "agent" {
name = "my-agent-entity"
policies = ["default"]
}
resource "vault_agent_registration" "example" {
display_name = "my-agent"
entity_id = vault_identity_entity.agent.id
}With Ceiling Policiesresource "vault_policy" "agent_ceiling" {
name = "agent-ceiling-policy"
policy = <<EOT
path "secret/data/*" {
capabilities = ["read"]
}
EOT
}
resource "vault_agent_registration" "example" {
display_name = "my-agent"
entity_id = vault_identity_entity.agent.id
ceiling_policy_identifiers = [vault_policy.agent_ceiling.name]
}Best PracticesFor Users
For Developers
Security Considerations
Design Decision: Resource Only (No Data Source)This implementation includes only the Why No Data Source?
When a Data Source Might Be UsefulA data source could be valuable in future versions for scenarios like:
If these use cases emerge, a data source can be added in a future release without breaking changes. Future EnhancementsPotential improvements for future versions:
References
Changelog Entry* **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+.Testing InstructionsPrerequisites
Running Tests# Run all agent registration tests
TF_ACC=1 go test ./internal/vault/sys -v -run TestAccAgentRegistration
# Run specific test
TF_ACC=1 go test ./internal/vault/sys -v -run TestAccAgentRegistration_basic
# Run with namespace tests (requires Enterprise)
TF_ACC=1 VAULT_NAMESPACE=root go test ./internal/vault/sys -v -run TestAccAgentRegistration_namespaceManual Testing# Initialize Terraform
terraform init
# Plan changes
terraform plan
# Apply configuration
terraform apply
# Import existing agent
terraform import vault_agent_registration.example my-agent
# Verify state
terraform showConclusionThis implementation provides a complete, production-ready resource for managing Vault agent registrations. It follows all TFVP best practices, includes comprehensive testing, and provides clear documentation for users. The resource integrates seamlessly with Vault's identity system and policy framework to enable secure, manageable agent deployments. |
2bd2642 to
0914cce
Compare
Description
Jira: https://hashicorp.atlassian.net/browse/VAULT-44159
Checklist
Output from acceptance testing:
Community Note
PCI review checklist
I have documented a clear reason for, and description of, the change I am making.
If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
If applicable, I've documented the impact of any changes to security controls.
Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.