Skip to content

feat: added the ability to add custom conditions on the role - #94

Open
gambol99 wants to merge 4 commits into
mainfrom
feat/iam_conditions
Open

feat: added the ability to add custom conditions on the role#94
gambol99 wants to merge 4 commits into
mainfrom
feat/iam_conditions

Conversation

@gambol99

Copy link
Copy Markdown
Member

No description provided.

@gambol99
gambol99 requested a review from m13t July 28, 2026 16:02
@gambol99
gambol99 force-pushed the feat/iam_conditions branch from 963cfbe to c36c859 Compare July 28, 2026 16:03
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

Pull Request Review Status

  • 🖌 Terraform Format and Style: success
  • 🔍 Terraform Linting: success
  • 👮 Terraform Security Check: success
  • 👮 Terraform Security Checkov: success
  • 🔘 Terraform Tests: success
  • 🔧 Terraform Initialisation: success
  • 🤖 Terraform Validation: success
  • 🤖 Terraform Example Validation: success
  • 📖 Terraform Documentation: success
  • 🔖 Commitlint: failure

Working Directory: modules/remote_state
Pusher: @gambol99, Action: pull_request
Workflow Run Link: https://github.com/appvia/terraform-aws-oidc/actions/runs/30474655161

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

Pull Request Review Status

  • 🖌 Terraform Format and Style: success
  • 🔍 Terraform Linting: success
  • 👮 Terraform Security Check: success
  • 👮 Terraform Security Checkov: success
  • 🔘 Terraform Tests: success
  • 🔧 Terraform Initialisation: success
  • 🤖 Terraform Validation: success
  • 🤖 Terraform Example Validation: success
  • 📖 Terraform Documentation: success
  • 🔖 Commitlint: failure

Working Directory: modules/provider
Pusher: @gambol99, Action: pull_request
Workflow Run Link: https://github.com/appvia/terraform-aws-oidc/actions/runs/30474655161

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

Pull Request Review Status

  • 🖌 Terraform Format and Style: success
  • 🔍 Terraform Linting: success
  • 👮 Terraform Security Check: success
  • 👮 Terraform Security Checkov: success
  • 🔘 Terraform Tests: success
  • 🔧 Terraform Initialisation: success
  • 🤖 Terraform Validation: success
  • 🤖 Terraform Example Validation: success
  • 📖 Terraform Documentation: success
  • 🔖 Commitlint: failure

Working Directory: modules/role
Pusher: @gambol99, Action: pull_request
Workflow Run Link: https://github.com/appvia/terraform-aws-oidc/actions/runs/30474655161

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new trust_policy_conditions input to the modules/role Terraform module, allowing callers to append custom IAM trust policy conditions to all assume-role statements generated by the module (OIDC sts:AssumeRoleWithWebIdentity and Azure DevOps hub-to-spoke sts:AssumeRole).

Changes:

  • Introduces trust_policy_conditions variable (with validations) to accept additional aws_iam_policy_document condition blocks.
  • Applies these conditions across read-write, read-only, and state-reader trust policy documents (including hub-to-spoke assume role statements).
  • Adds a dedicated Terraform test file plus updates docs and an example to demonstrate and verify behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/role.trust_conditions.tftest.hcl Adds end-to-end Terraform tests asserting custom conditions are rendered (and validated) across all roles/statements.
modules/role/variables.tf Adds the new trust_policy_conditions input and validation rules.
modules/role/shared.tf Appends trust_policy_conditions to state-reader trust policy statements.
modules/role/readonly.tf Appends trust_policy_conditions to read-only trust policy statements.
modules/role/main.tf Appends trust_policy_conditions to read-write trust policy statements.
modules/role/README.md Documents how to use trust_policy_conditions and updates the input table.
examples/role/main.tf Demonstrates usage of trust_policy_conditions in the example configuration.
Comments suppressed due to low confidence (1)

tests/role.trust_conditions.tftest.hcl:203

  • The overridden Azure DevOps OIDC provider ARN uses arn:aws:iam::aws:oidc-provider/..., but IAM OIDC provider ARNs are account-scoped (arn:aws:iam::<account_id>:oidc-provider/...). Using a realistic ARN avoids brittle tests if future validation is added.
    values = {
      url = "https://vstoken.dev.azure.com/00000000-0000-0000-0000-000000000000"
      arn = "arn:aws:iam::aws:oidc-provider/vstoken.dev.azure.com/00000000-0000-0000-0000-000000000000"
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread modules/role/variables.tf Outdated
Comment thread modules/role/README.md Outdated
Comment thread tests/role.trust_conditions.tftest.hcl
gambol99 and others added 3 commits July 29, 2026 18:16
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants