tharsis_managed_identity_access_rule
Defines and manages a managed identity access rule.
Example Usage​
resource "tharsis_managed_identity_access_rule" "eligible_principals" {
managed_identity_id = tharsis_managed_identity.aws.id
type = "eligible_principals"
run_stage = "plan"
allowed_service_account_ids = [tharsis_service_account.this.id]
}
resource "tharsis_managed_identity_access_rule" "module_attestation" {
managed_identity_id = tharsis_managed_identity.aws.id
type = "module_attestation"
run_stage = "apply"
verify_state_lineage = true
module_attestation_policies = [
{
public_key = file("${path.module}/attestation-key.pem")
predicate_type = "https://slsa.dev/provenance/v1"
}
]
}
Behavior​
- By default, anyone with deployer access to a managed identity can assume it. Access rules restrict this.
- Rules of the same type are combined with OR logic: one match is enough. Rules of different types are combined with AND logic: at least one rule of each type must match.
- A rule applies to one run stage,
planorapply. If no rule exists for a stage, any principal may assume the identity for that stage.
Rule types​
eligible_principalslimits use to specific users, teams, or service accounts, given byallowed_user_ids,allowed_team_ids, andallowed_service_account_ids.module_attestationrequires the root module to carry an attestation signed with the public key of one of themodule_attestation_policies. This is supported only for modules in the Tharsis registry.
State lineage​
When verify_state_lineage is true, the rule also verifies that the workspace's current state came from the same module source. It defaults to false.
Schema​
Required​
managed_identity_id(String) The ID or TRN of the connected managed identity.run_stage(String) Type of job, plan or apply.type(String) Type of access rule: eligible_principals or module_attestation.
Optional​
allowed_service_account_ids(Set of String) List of service account IDs allowed to use the managed identity associated with this rule.allowed_service_accounts(Set of String, Deprecated) List of resource paths of service accounts allowed to use the managed identity associated with this rule.allowed_team_ids(Set of String) List of team IDs allowed to use the managed identity associated with this rule.allowed_teams(Set of String, Deprecated) List of names of teams allowed to use the managed identity associated with this rule.allowed_user_ids(Set of String) List of user IDs allowed to use the managed identity associated with this rule.allowed_users(Set of String, Deprecated) List of usernames allowed to use the managed identity associated with this rule.module_attestation_policies(Attributes List) Used to verify that a module has an in-toto attestation that is signed with the specified public key and an optional predicate type. (see below for nested schema)verify_state_lineage(Boolean) Whether to verify that the workspace's current state is from the same module source, default is false.
Read-Only​
id(String) String identifier of the access rule.