diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b5c33b6a..527fd5945 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ FEATURES: * Add support for new WIF fields in `vault_gcp_secret_backend`. Requires Vault 1.17+. *Available only for Vault Enterprise* ([#2249](https://github.com/hashicorp/terraform-provider-vault/pull/2249)). * Add support for new WIF fields in `vault_aws_auth_backend_client`. Requires Vault 1.17+. *Available only for Vault Enterprise* ([#2243](https://github.com/hashicorp/terraform-provider-vault/pull/2243)). * Add support for new WIF fields in `vault_azure_secret_backend`. Requires Vault 1.17+. *Available only for Vault Enterprise* ([#2250](https://github.com/hashicorp/terraform-provider-vault/pull/2250)) +* Add new data source and resource `vault_pki_secret_backend_config_est`. Requires Vault 1.16+. *Available only for Vault Enterprise* ([#2246](https://github.com/hashicorp/terraform-provider-vault/pull/2246)) IMPROVEMENTS: * return a useful error when delete fails for the `vault_jwt_auth_backend_role` resource: ([#2232](https://github.com/hashicorp/terraform-provider-vault/pull/2232)) diff --git a/internal/consts/consts.go b/internal/consts/consts.go index 2fd4dc35f..c0ca12539 100644 --- a/internal/consts/consts.go +++ b/internal/consts/consts.go @@ -424,6 +424,14 @@ const ( FieldDelegatedAuthAccessors = "delegated_auth_accessors" FieldPluginVersion = "plugin_version" FieldUseMSGraphAPI = "use_microsoft_graph_api" + FieldEnabled = "enabled" + FieldDefaultMount = "default_mount" + FieldDefaultPathPolicy = "default_path_policy" + FieldLabelToPathPolicy = "label_to_path_policy" + FieldAuthenticators = "authenticators" + FieldEnableSentinelParsing = "enable_sentinel_parsing" + FieldAuditFields = "audit_fields" + FieldLastUpdated = "last_updated" /* common environment variables diff --git a/vault/data_source_pki_secret_backend_config_est.go b/vault/data_source_pki_secret_backend_config_est.go new file mode 100644 index 000000000..96448aa06 --- /dev/null +++ b/vault/data_source_pki_secret_backend_config_est.go @@ -0,0 +1,165 @@ +package vault + +import ( + "context" + "errors" + "fmt" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-vault/internal/consts" + "github.com/hashicorp/terraform-provider-vault/internal/provider" + "github.com/hashicorp/vault/api" +) + +func pkiSecretBackendConfigEstDataSource() *schema.Resource { + return &schema.Resource{ + Description: "Reads Vault PKI EST configuration", + ReadContext: provider.ReadContextWrapper(readPKISecretBackendConfigEst), + Schema: map[string]*schema.Schema{ + consts.FieldBackend: { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Path where PKI engine is mounted", + }, + consts.FieldEnabled: { + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether EST is enabled", + }, + consts.FieldDefaultMount: { + Type: schema.TypeBool, + Computed: true, + Description: "If set, this mount is registered as the default `.well-known/est` URL path. Only a single mount can enable this across a Vault cluster", + }, + consts.FieldDefaultPathPolicy: { + Type: schema.TypeString, + Computed: true, + Description: "Required to be set if default_mount is enabled. Specifies the behavior for requests using the default EST label. Can be sign-verbatim or a role given by role:", + }, + consts.FieldLabelToPathPolicy: { + Type: schema.TypeMap, + Computed: true, + Description: "A pairing of an EST label with the redirected behavior for requests hitting that role. The path policy can be sign-verbatim or a role given by role:. Labels must be unique across Vault cluster, and will register .well-known/est/