Resource
dcloud_iam_role
An IAM role: a set of policies that users or federated identities assume.
Example Usage
resource "dcloud_iam_role" "deploy_from_github" {
name = "deploy-from-github"
description = "Assumed by GitHub Actions in acme/web"
trust_policy = jsonencode({
Version = "2024-01-01"
Statement = [{
Effect = "Allow"
Principal = { Federated = dcloud_iam_oidc_provider.github.rn }
Condition = { StringLike = { sub = "repo:acme/web:ref:refs/heads/main" } }
}]
})
}Schema
Required
name(String) The role’s name. Up to 128 characters. Changing it replaces the resource.
Optional
description(String) What the role is for. Up to 512 characters. Changing it replaces the resource.trust_policy(String) Trust policy document (JSON) saying who may assume the role; usejsonencode.
Read-Only
id(String) The resource's id.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
terraform import dcloud_iam_role.deploy_from_github <role-id>Generated from the provider's schema.
Related