The service principal key resource manages a service principal key.
The user or service account that is running Terraform when creating a hcp_service_principal_key
resource must have roles/admin
on the parent resource; either the project or organization.
resource "hcp_service_principal" "example" {
name = "example-sp"
}
resource "hcp_service_principal_key" "key" {
service_principal = hcp_service_principal.example.resource_name
}
resource "hcp_service_principal" "example" {
name = "example-sp"
}
# Note this requires the Terraform to be run regularly
resource "time_rotating" "key_rotation" {
rotation_days = 14
}
resource "hcp_service_principal_key" "key" {
service_principal = hcp_service_principal.example.resource_name
rotation_triggers {
rotation_time = time_rotating.key_rotation.rotation_rfc3339
}
}
service_principal
(String) The service principal's resource name for which a key should be created.rotate_triggers
(Map of String) A map of arbitrary string key/value pairs that will force recreation of the key when they change, enabling key based on external conditions such as a rotating timestamp. Changing this forces a new resource to be created.client_id
(String) The generated service principal client_id.client_secret
(String, Sensitive) The generated service principal client_secret.resource_name
(String) The service principal key's resource name.