Module Reference

IAM — Identity & Access

IAM roles, policies, and GitHub OIDC provider for Ontopix services and CI/CD workflows.

Production

Directory: global/iam/

Files: roles.tf, policies.tf, github_oidc.tf, github_oidc_roles.tf, outputs.tf, variables.tf

What It Manages

All IAM roles, policy attachments, and the GitHub Actions OIDC identity provider.

Module Scope

The iam/ module owns two categories of resources:

  1. The shared OIDC provider — a single aws_iam_openid_connect_provider used by all GitHub Actions roles across all modules.
  2. Cross-cutting GitHub Actions OIDC roles — roles whose target AWS service is not centrally managed in this repository (e.g. Terraform state access, Lambda deploy). Service-specific roles live in their respective modules instead (ecr/ owns ECR roles, codeartifact/ owns CodeArtifact roles).
  3. Service roles — non-OIDC roles for AWS services (Amplify, App Runner, CDK, Lambda).

When adding a new GitHub Actions OIDC role, place it in the module that manages the target service. If no such module exists (e.g. S3 deploy, CloudFront invalidation), add it here in iam/. See the Request IAM Role guide.

GitHub OIDC Provider

A single OIDC provider enables all GitHub Actions workflows across the ontopix organization to authenticate to AWS without long-lived credentials:

aws_iam_openid_connect_provider.github_actions
# URL: https://token.actions.githubusercontent.com
# Audience: sts.amazonaws.com

This provider is shared by the CodeArtifact and ECR module roles, as well as the cross-cutting OIDC roles defined in this module.

GitHub Actions OIDC Roles

Cross-cutting OIDC roles for CI and deploy workflows. Trust tiers follow ADR-003.

The tier model enforces a code vs infrastructure boundary: GHA can update code in existing resources (Deploy tier) but never create, delete, or configure resources (developer-only via terraform apply). See ADR-003 for the full philosophy and tradeoff analysis.

RoleTierPermissionsRestricted To
GitHubActions-Terraform-PlanRoleCITF state read + ReadOnlyAccess + AgentCore readAny branch, all ontopix/* repos
GitHubActions-Lambda-DeployRoleDeployLambda deploy + invoke, S3 artifacts, SSM readmaster/pre/dev branches only

Audit Role

A read-only role for security auditing and compliance reviews. Auditors can inspect configurations across all AWS services without risk of accidental modifications or access to sensitive data.

RoleTrusted PrincipalsPurpose
AuditRolealbert.puigsech@ontopix.ai, josepmaria.roca@ontopix.ai, jano.carrion@ontopix.aiSecurity and compliance reviews

Attached policies:

PolicyTypePurpose
ReadOnlyAccessAWS ManagedBroad read access across all services
SecurityAuditAWS ManagedSecurity-focused read access (IAM, VPC, CloudTrail, GuardDuty, Config)
NewServiceReadAccessInlineRead access for services too new for ReadOnlyAccess (Bedrock, AgentCore)
DenySecretsAndSensitiveDataInline (Deny)Blocks access to secret values, SSM parameters, S3 objects, KMS decrypt, DynamoDB data

To assume the role:

aws sts assume-role \
  --role-arn "arn:aws:iam::{ACCOUNT_ID}:role/AuditRole" \
  --role-session-name "audit-$(date +%Y%m%d)"

Service Roles

RoleServicePurpose
AmplifyAdminAmplifyAdministrate Amplify apps
AmplifyDeveloperAmplifyDevelop Amplify apps
Amplify-admin-roleAmplifyBackend deployment
cdk-cfn-exec-role-*-us-east-1CloudFormationCDK execution (us-east-1)
cdk-cfn-exec-role-*-eu-central-1CloudFormationCDK execution (eu-central-1)
ontopix-schemas-schemas-deployerLambdaSchemas deployment
mcp-lambda-edge-role-devLambda@EdgeEdge functions
mcp-hello-world-apprunner-*App RunnerMCP Hello World service
mcp-hello-calendar-apprunner-*App RunnerMCP Hello Calendar service
mcp-hello-orders-apprunner-*App RunnerMCP Hello Orders service

Policy Attachments

RolePolicyType
AmplifyAdminAdministratorAccess-AmplifyAWS Managed
schemas-deployerAWSLambdaBasicExecutionRoleAWS Managed
lambda-edgeAWSLambdaBasicExecutionRoleAWS Managed
Terraform-PlanRoleGitHubActions-TerraformPlanAccessCustom
Terraform-PlanRoleReadOnlyAccessAWS Managed
Lambda-DeployRoleGitHubActions-LambdaDeployAccessCustom
AuditRoleReadOnlyAccessAWS Managed
AuditRoleSecurityAuditAWS Managed
AuditRoleNewServiceReadAccessInline
AuditRoleDenySecretsAndSensitiveDataInline (Deny)

Lambda Deploy: S3 Artifact Convention

The GitHubActions-Lambda-DeployRole supports S3-based Lambda deployments for any project that follows the bucket naming convention:

{project}-{env}-lambda-artifacts[-optional-suffix]

What the role provides:

CapabilityActionsResource Scope
Deploy Lambda codeUpdateFunctionCode, GetFunctionAll Lambda functions in account
Upload/read S3 artifactsPutObject, GetObject*-*-lambda-artifacts*/lambdas/*
List artifact versionsListBucket*-*-lambda-artifacts*
Post-deploy smoke testsInvokeFunctionAll Lambda functions in account
SSM drift detectionGetParameter, GetParametersByPathAll SSM parameters in account

How it works:

  1. Your project creates an S3 bucket in its .infra/ following the naming convention (e.g., myproject-dev-lambda-artifacts)
  2. Your deploy workflow uploads Lambda ZIPs to s3://{bucket}/lambdas/{component}/{version}-{sha}.zip
  3. The workflow calls aws lambda update-function-code --s3-bucket {bucket} --s3-key lambdas/{component}/{version}-{sha}.zip
  4. Post-deploy smoke tests invoke each Lambda with a test event to verify health
  5. Optional SSM drift detection reads parameters to compare against source of truth

No infra PR needed — the IAM policy uses a convention-based S3 pattern. Any bucket matching *-*-lambda-artifacts* is automatically accessible.

How to Request a New Role

See the Request IAM Role guide.