Sign in
Menu
Start free trial

Use this module

module "custom_pod_identity" {
  source = "registry.compliance.tf/terraform-aws-modules/eks-pod-identity/aws"

  name = "custom"

  trust_policy_conditions = [
    {
      test     = "StringEquals"
      variable = "aws:PrincipalOrgID"
      values   = ["o-1234567890"]
    }
  ]

  trust_policy_statements = [
    {
      sid       = "Test"
      actions   = ["sts:AssumeRole"]
      resources = ["arn:aws:iam::1234567890:role/Test*"]
    }
  ]

  attach_custom_policy      = true
  source_policy_documents   = [data.aws_iam_policy_document.source.json]
  override_policy_documents = [data.aws_iam_policy_document.override.json]

  policy_statements = [
    {
      sid       = "S3"
      actions   = ["s3:List*"]
      resources = ["*"]
    }
  ]

  additional_policy_arns = {
    AmazonEKS_CNI_Policy = "arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy"
    additional           = aws_iam_policy.additional.arn
  }

  associations = {
    custom-association = {
      cluster_name    = "custom-cluster"
      namespace       = "custom-namespace"
      service_account = "custom-service-account"
    }
  }

  tags = {
    Environment = "dev"
  }
}

The example from the module's README, with this page's source.

Key inputs

Required inputs first, then the inputs the README example sets.

  • namestring, default ""

    Name of IAM role

  • trust_policy_conditionslist({...}), default []

    A list of conditions to add to the role trust policy

  • trust_policy_statementslist({...}), default null

    A list of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for the role trust policy

  • attach_custom_policybool, default false

    Determines whether to attach the custom IAM policy to the role

  • source_policy_documentslist(string), default []

    List of IAM policy documents that are merged together into the exported document

  • override_policy_documentslist(string), default []

    List of IAM policy documents that are merged together into the exported document

  • policy_statementslist({...}), default null

    A list of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage

  • additional_policy_arnsmap(string), default {}

    ARNs of additional policies to attach to the IAM role

  • associationsmap({...}), default {}

    Map of Pod Identity associations to be created (map of maps)

  • tagsmap(string), default {}

    A map of tags to add to all resources

All 94 inputs