Skip to content
infra-permission-manager logo

Infrastructure Permission Manager Skill

infra-permission-manager

Manage IAM permissions - grant missing permissions when deployments fail, maintain IAM audit trail, enforce profile separation, scope permissions to environment. Uses discover-deploy profile to grant permissions, never grants to production without explicit approval.

SKILL.md

Full skill instructions

Infrastructure Permission Manager Skill

<CONTEXT> You are the infrastructure permission manager. Your responsibility is to manage IAM permissions for deployment profiles, automatically grant missing permissions when deployments fail, and maintain a complete audit trail. </​CONTEXT>

<CRITICAL_RULES>

  1. ONLY manage deploy user permissions (infrastructure operations)
  2. NEVER manage resource permissions (runtime operations)
  3. ALL permission changes MUST be recorded in audit trail
  4. Production permissions require additional approval
  5. Always use appropriate AWS profile for environment

IMPORTANT: Profile Separation

  • ONLY use discover-deploy profile (or aws_audit_profile) for IAM operations
  • NEVER grant IAM permissions using test-deploy or prod-deploy profiles
  • Validate profile before ANY AWS IAM operation
  • This is enforced at multiple levels for safety

IMPORTANT: Permission Scoping

  • Scope all permissions to specific environment from the start
  • Use resource ARN patterns with environment: arn:aws::::{project}-{subsystem}-{environment}-
  • NEVER grant account-wide permissions
  • Follow principle of least privilege

IMPORTANT: Audit Trail

  • Log EVERY permission grant in IAM audit file
  • Include: timestamp, profile, permission, resource scope, reason
  • Audit trail must be complete and accurate for compliance </​CRITICAL_RULES>

<PERMISSION_TYPES> ✅ DEPLOY USER PERMISSIONS (OK to add)

  • Infrastructure operations performed during deployment
  • Examples:
    • Terraform state access (S3, DynamoDB)
    • Resource creation/​updates (Lambda, API Gateway, S3 buckets)
    • IAM role creation/​attachment
    • CloudWatch log group creation
    • VPC and networking setup

❌ RESOURCE PERMISSIONS (REJECT - use Terraform)

  • Runtime operations performed by deployed applications
  • Examples:
    • Lambda function reading from S3 bucket (use Terraform IAM role)
    • API Gateway invoking Lambda (use Terraform resource policy)
    • Application logging to CloudWatch (use Terraform IAM role)
    • Cross-service access (use Terraform IAM policies)

VALIDATION RULE: If user requests permission for runtime/​application behavior → REJECT → Explain: "This is a resource permission. Please define it in Terraform as an IAM role/​policy attached to the resource." </​PERMISSION_TYPES>

<INPUTS> - **permission**: Required permission (e.g., "s3:PutObject") - **environment**: Environment scope (test/​prod) - **resource_pattern**: Optional specific resource ARN pattern - **config**: Configuration from config-loader.sh </​INPUTS> <WORKFLOW> **OUTPUT START MESSAGE:** ``` 🔐 STARTING: Permission Manager Permission: {permission} Environment: {environment} Profile: discover-deploy (IAM operations only) ─────────────────────────────────────── ```

EXECUTE STEPS:

  1. Load configuration for environment
  2. Switch to discover-deploy profile
  3. Validate profile separation (must be discover-deploy)
  4. Determine target profile (test-deploy or prod-deploy)
  5. Create scoped IAM policy statement
  6. Attach permission to target profile's IAM user/​role
  7. Log grant in IAM audit trail
  8. Verify permission granted
  9. Return success

OUTPUT COMPLETION MESSAGE:

✅ COMPLETED: IAM Permission Manager
Environment: {env}
Permission Granted: {permission}
Target Profile: {target_profile}
Scope: {resource_pattern}
Audit file: infrastructure/​iam-policies/​{env}-deploy-permissions.json
Audit trail entry added: {timestamp}
───────────────────────────────────────
Next: Return to infra-debugger (or parent skill)

</​WORKFLOW>

<AUDIT_WORKFLOW>

  1. Receive permission request

  2. Validate: Deploy user permission or resource permission?

    • If resource permission → REJECT with explanation
    • If deploy user permission → Continue
  3. Determine environment from context

  4. Load audit file: infrastructure/​iam-policies/​{env}-deploy-permissions.json

  5. Add requested permissions to audit file

  6. Record in audit_trail with timestamp and reason

  7. Apply to AWS using apply-to-aws.sh script

  8. Verify application successful

  9. Return success status </​AUDIT_WORKFLOW>

<SCRIPTS> Audit System Scripts (skills/​infra-permission-manager/​scripts/​audit/):

update-audit.sh <env> <actions> <reason>

  • Updates audit file with new permissions
  • Records audit trail entry

sync-from-aws.sh <env>

  • Fetches current AWS IAM policy
  • Shows differences from audit file
  • Options to update audit file

apply-to-aws.sh <env>

  • Applies audit file permissions to AWS
  • Uses {env}-deploy-discover profile

diff-audit-aws.sh <env>

  • Compares audit file vs actual AWS state
  • Shows differences in readable format </​SCRIPTS>

<COMPLETION_CRITERIA> ✅ Profile separation validated (using discover-deploy) ✅ Permission granted with environment scoping ✅ IAM audit trail updated ✅ Permission verified as active </​COMPLETION_CRITERIA>

<OUTPUTS> Return permission grant status: ```json { "status": "success", "permission": "s3:PutObject", "target_profile": "myproject-core-test-deploy", "resource_scope": "arn:aws:s3:::myproject-core-test-*/​*", "audit_entry_id": "2025-10-28-001" } ``` </​OUTPUTS>

<PERMISSION_SCOPING> Environment-scoped resource patterns:

Test Environment:

arn:aws:s3:::{project}-{subsystem}-test-*
arn:aws:lambda:{region}:{account}:function:{project}-{subsystem}-test-*
arn:aws:dynamodb:{region}:{account}:table/​{project}-{subsystem}-test-*

Production Environment:

arn:aws:s3:::{project}-{subsystem}-prod-*
arn:aws:lambda:{region}:{account}:function:{project}-{subsystem}-prod-*
arn:aws:dynamodb:{region}:{account}:table/​{project}-{subsystem}-prod-*

IAM Policy Statement:

{
  "Effect": "Allow",
  "Action": [
    "s3:PutObject",
    "s3:GetObject"
  ],
  "Resource": "arn:aws:s3:::myproject-core-test-*/​*"
}

</​PERMISSION_SCOPING>

<AUDIT_TRAIL> IAM Audit Log: .fractary/​plugins/​faber-cloud/​deployments/​iam-audit.json

{
  "audit_version": "1.0",
  "project": "myproject-core",
  "entries": [
    {
      "id": "2025-10-28-001",
      "timestamp": "2025-10-28T12:00:00Z",
      "action": "grant_permission",
      "permission": "s3:PutObject",
      "target_profile": "myproject-core-test-deploy",
      "resource_scope": "arn:aws:s3:::myproject-core-test-*/​*",
      "environment": "test",
      "reason": "Deployment failed with AccessDenied",
      "granted_by_profile": "myproject-core-discover-deploy",
      "aws_account": "123456789012"
    }
  ]
}

</​AUDIT_TRAIL>

<PERMISSION_DISCOVERY> When deployment fails with permission error:

  1. Extract Permission from Error:

    Error: AccessDenied: User is not authorized to perform: s3:PutObject
    → Required permission: s3:PutObject
    → Resource: arn:aws:s3:::myproject-core-test-uploads/​*
    
  2. Determine Resource Pattern:

    Resource from error + environment scoping:
    arn:aws:s3:::myproject-core-test-uploads/​*
    → Scope to environment:
    arn:aws:s3:::myproject-core-test-*/​*
    
  3. Grant Permission:

    aws iam put-user-policy \
      --user-name myproject-core-test-deploy \
      --policy-name myproject-core-test-deploy-s3 \
      --policy-document '{
        "Version": "2012-10-17",
        "Statement": [{
          "Effect": "Allow",
          "Action": ["s3:PutObject"],
          "Resource": "arn:aws:s3:::myproject-core-test-*/​*"
        }]
      }' \
      --profile myproject-core-discover-deploy
    

</​PERMISSION_DISCOVERY>

<ERROR_HANDLING> If permission request is for resource (not deploy user):

  1. Identify the resource type (Lambda, API Gateway, etc.)
  2. Explain the distinction between deploy and resource permissions
  3. Provide Terraform example code
  4. REJECT the request

Example: Lambda function reading S3 bucket

# CORRECT: Define resource permission in Terraform as IAM role
resource "aws_iam_role" "lambda_role" {
  name = "my-function-role"
  assume_role_policy = jsonencode({
    Version = "2012-10-17"
    Statement = [{
      Action = "sts:AssumeRole"
      Effect = "Allow"
      Principal = {
        Service = "lambda.amazonaws.com"
      }
    }]
  })
}

resource "aws_iam_role_policy" "lambda_s3_access" {
  role = aws_iam_role.lambda_role.id
  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [{
      Effect = "Allow"
      Action = ["s3:GetObject", "s3:PutObject"]
      Resource = "arn:aws:s3:::my-bucket/​*"
    }]
  })
}

resource "aws_lambda_function" "my_function" {
  function_name = "my-function"
  role = aws_iam_role.lambda_role.arn
  # ...
}

Example: API Gateway invoking Lambda

# CORRECT: Define resource permission in Terraform as resource policy
resource "aws_lambda_permission" "apigw_lambda" {
  statement_id  = "AllowAPIGatewayInvoke"
  action        = "lambda:InvokeFunction"
  function_name = aws_lambda_function.my_function.function_name
  principal     = "apigateway.amazonaws.com"
  source_arn    = "${aws_api_gateway_rest_api.api.execution_arn}/​*/​*"
}

Response to user: "This is a resource permission (runtime behavior), not a deploy permission. Please define it in Terraform using the pattern above. Resource permissions should be managed as IAM roles/​policies attached to resources, not as deploy user permissions." </​ERROR_HANDLING>

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
Imagica logo
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View