hashicorp / terraform-provider-vault

Terraform Vault provider
https://www.terraform.io/docs/providers/vault/
Mozilla Public License 2.0
451 stars 535 forks source link

[Enhancement]: Need id to create pki issuer and pki role for an intermediate certificate #2027

Open symmediabruell opened 9 months ago

symmediabruell commented 9 months ago

Description

I want to set an issuer for a intermediate certificate (vault_pki_secret_backend_root_sign_intermediate). Also I want to create a role for the intermediate certificate (vault_pki_secret_backend_role). I found no way to fetch the Id of the intermediate certificate to create a issuer with a name for it.

Affected Resource(s) and/or Data Source(s)

vault_pki_secret_backend_issuer

Potential Terraform Configuration

No response

References

No response

Would you like to implement a fix?

None

Starimmigrant commented 4 months ago

Have you found a solution yet?

symmediabruell commented 4 months ago

Yes, I use the following code to get the issuer:

resource "vault_pki_secret_backend_issuer" "xxx_yyy_env_ca" { backend = vault_pki_secret_backend_intermediate_set_signed.xxx_yyy_env_ca.backend issuer_ref = vault_pki_secret_backend_intermediate_set_signed.xxx_yyy_env_ca.imported_issuers[0] issuer_name = vault_pki_secret_backend_key.xxx_yyy_env_ca.key_name }

fairclothjm commented 4 months ago

@symmediabruell Can this be closed or are there improvements that you would like to see here? Thanks

symmediabruell commented 4 months ago

If the behavior of "imported_issuers[0]" is deterministic the ticket could be closed.

Blefish commented 2 months ago

Any update for this? When I was testing rotation of intermediate, for some reason the imported_issuers[0] contains CA issuer id only. Before it contained intermediate issuer and CA issuer as imported_issuers[1]