Skip to content

[DEVOPS-4425] feat: add ephemeral resources for creds and certs#30

Merged
Richard Boisvert (rbstp) merged 3 commits into
masterfrom
devops/ephemeral
May 25, 2026
Merged

[DEVOPS-4425] feat: add ephemeral resources for creds and certs#30
Richard Boisvert (rbstp) merged 3 commits into
masterfrom
devops/ephemeral

Conversation

@rbstp
Copy link
Copy Markdown
Contributor

@rbstp Richard Boisvert (rbstp) commented May 1, 2026

Warning

Two latent provider issues surfaced, because of DVLS 2026.1, that are worth follow-up but outside this PR. Temporary fix with 2nd commit.

  • Tags should be SetAttribute (DVLS doesn't preserve order, so any user with non-alphabetical tags hits the same inconsistent result after apply error we just papered over).
  • DVLS no longer auto-creates folders when an entry's path references a missing one — consider auto-creating in the provider's Create, or expose a dvls_entry_folder resource.

Summary

Adds ephemeral resources for the certificate entry and all six credential subtypes (username_password, api_key, secret, ssh_key, azure_service_principal, connection_string). Ephemerals fetch sensitive values during plan/apply but never persist them in Terraform state.

What's new

  • 7 new ephemeral resources: dvls_entry_certificate and dvls_entry_credential_*
  • Shared base types in credential_ephemeral.go:
    • ephemeralResourceBase — Configure boilerplate
    • credentialEphemeralBase — adds id/name ExactlyOneOf validator
    • credentialEphemeralCommonAttributes() — shared schema (id, vault_id, name, folder, description, tags)
    • Each ephemeral aliases its existing *DataSourceModel and reuses setEntryCredential*DataModel, so there's one source of truth per subtype.
    • Docs + example HCL for every new resource.

@atlantis-devolutions
Copy link
Copy Markdown

Error: This repo is not allowlisted for Atlantis.

Comment on lines +20 to +24
Config: testAccEntryCredentialApiKeyEphemeralConfig("tf_test_api_key_eph_byname", "tf_test_api_key_eph_byname", `
ephemeral "dvls_entry_credential_api_key" "test" {
vault_id = dvls_vault.test.id
name = dvls_entry_credential_api_key.test.name
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce que ce serait plus clean de le déclarer plus tôt et de le passer en paramètre ?

Comment on lines +50 to +55
Config: testAccEntryCredentialApiKeyEphemeralConfig("tf_test_api_key_eph_byid", "tf_test_api_key_eph_byid", `
ephemeral "dvls_entry_credential_api_key" "test" {
vault_id = dvls_vault.test.id
id = dvls_entry_credential_api_key.test.id
}
`),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Comment on lines +20 to +25
Config: testAccEntryCredentialAzureServicePrincipalEphemeralConfig("tf_test_azsp_eph_byname", "tf_test_azsp_eph_byname", `
ephemeral "dvls_entry_credential_azure_service_principal" "test" {
vault_id = dvls_vault.test.id
name = dvls_entry_credential_azure_service_principal.test.name
}
`),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Comment on lines +20 to +25
Config: testAccEntryCredentialConnectionStringEphemeralConfig("tf_test_connstr_eph_byname", "tf_test_connstr_eph_byname", `
ephemeral "dvls_entry_credential_connection_string" "test" {
vault_id = dvls_vault.test.id
name = dvls_entry_credential_connection_string.test.name
}
`),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Comment on lines +20 to +25
Config: testAccEntryCredentialSecretEphemeralConfig("tf_test_secret_eph_byname", "tf_test_secret_eph_byname", `
ephemeral "dvls_entry_credential_secret" "test" {
vault_id = dvls_vault.test.id
name = dvls_entry_credential_secret.test.name
}
`),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Comment on lines +20 to +25
Config: testAccEntryCredentialSSHKeyEphemeralConfig("tf_test_sshkey_eph_byname", "tf_test_sshkey_eph_byname", `
ephemeral "dvls_entry_credential_ssh_key" "test" {
vault_id = dvls_vault.test.id
name = dvls_entry_credential_ssh_key.test.name
}
`),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Comment on lines +51 to +56
Config: testAccEntryCredentialSSHKeyEphemeralConfig("tf_test_sshkey_eph_byid", "tf_test_sshkey_eph_byid", `
ephemeral "dvls_entry_credential_ssh_key" "test" {
vault_id = dvls_vault.test.id
id = dvls_entry_credential_ssh_key.test.id
}
`),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Comment on lines +80 to +100
%s

resource "dvls_vault" "test" {
name = %[2]q
}

resource "dvls_entry_credential_ssh_key" "test" {
vault_id = dvls_vault.test.id
name = %[3]q
description = "test entry for ephemeral resource"
folder = "tf_test_folder"
tags = ["acceptance", "tf-test"]
username = "testuser"
password = "testpassword"
passphrase = "testpassphrase"
private_key_data = "-----BEGIN OPENSSH PRIVATE KEY-----\nfake-key-data\n-----END OPENSSH PRIVATE KEY-----"
}

%s

%s
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je sais pas si ça vaudrait la peine de stocker ces strings autrement ou tout au même endroit pour faciliter leur maintenance dans le future si jamais on modifie un field ou une description ?

Comment on lines +20 to +25
Config: testAccEntryCredentialUsernamePasswordEphemeralConfig("tf_test_userpass_eph_byname", "tf_test_userpass_eph_byname", `
ephemeral "dvls_entry_credential_username_password" "test" {
vault_id = dvls_vault.test.id
name = dvls_entry_credential_username_password.test.name
}
`),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

@rbstp Richard Boisvert (rbstp) merged commit 28e713c into master May 25, 2026
2 checks passed
@rbstp Richard Boisvert (rbstp) deleted the devops/ephemeral branch May 25, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants