-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: GitHub workflow OIDC role claims #575
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update the release OIDC roles to use tag references as GitHub does not consistently pass the workflow's event name as part of the role assume request. Update the Terraform plan all workflow to use the default `forms-terraform-plan` role.
⚠ Terrform update availableTerragrunt: 0.54.15 (using 0.54.8) |
Staging: oidc_roles✅ Terraform Init: Plan: 0 to add, 2 to change, 3 to destroy Show summary
Show planResource actions are indicated with the following symbols:
~ update in-place
- destroy
Terraform will perform the following actions:
# aws_iam_role_policy_attachment.forms_terraform_plan_workflow_dispatch_readonly[0] will be destroyed
# (because aws_iam_role_policy_attachment.forms_terraform_plan_workflow_dispatch_readonly is not in configuration)
- resource "aws_iam_role_policy_attachment" "forms_terraform_plan_workflow_dispatch_readonly" {
- id = "forms-terraform-plan-workflow-dispatch-20240111201407942800000002" -> null
- policy_arn = "arn:aws:iam::aws:policy/ReadOnlyAccess" -> null
- role = "forms-terraform-plan-workflow-dispatch" -> null
}
# aws_iam_role_policy_attachment.forms_terraform_plan_workflow_dispatch_terraform_plan[0] will be destroyed
# (because aws_iam_role_policy_attachment.forms_terraform_plan_workflow_dispatch_terraform_plan is not in configuration)
- resource "aws_iam_role_policy_attachment" "forms_terraform_plan_workflow_dispatch_terraform_plan" {
- id = "forms-terraform-plan-workflow-dispatch-20240111201407937000000001" -> null
- policy_arn = "arn:aws:iam::687401027353:policy/OIDCPlanPolicy" -> null
- role = "forms-terraform-plan-workflow-dispatch" -> null
}
# module.github_workflow_roles.aws_iam_role.this["forms-terraform-apply-release"] will be updated in-place
~ resource "aws_iam_role" "this" {
~ assume_role_policy = jsonencode(
~ {
~ Statement = [
~ {
~ Condition = {
~ StringLike = {
~ "token.actions.githubusercontent.com:sub" = "repo:cds-snc/forms-terraform:release" -> "repo:cds-snc/forms-terraform:ref:refs/tags/v*"
}
}
# (3 unchanged attributes hidden)
},
]
# (1 unchanged attribute hidden)
}
)
id = "forms-terraform-apply-release"
name = "forms-terraform-apply-release"
tags = {
"CostCentre" = "forms-platform-staging"
"Terraform" = "true"
}
# (8 unchanged attributes hidden)
}
# module.github_workflow_roles.aws_iam_role.this["forms-terraform-plan-workflow-dispatch"] will be destroyed
# (because key ["forms-terraform-plan-workflow-dispatch"] is not in for_each map)
- resource "aws_iam_role" "this" {
- arn = "arn:aws:iam::687401027353:role/forms-terraform-plan-workflow-dispatch" -> null
- assume_role_policy = jsonencode(
{
- Statement = [
- {
- Action = "sts:AssumeRoleWithWebIdentity"
- Condition = {
- StringLike = {
- "token.actions.githubusercontent.com:sub" = "repo:cds-snc/forms-terraform:*"
}
}
- Effect = "Allow"
- Principal = {
- Federated = "arn:aws:iam::687401027353:oidc-provider/token.actions.githubusercontent.com"
}
},
]
- Version = "2012-10-17"
}
) -> null
- create_date = "2024-01-11T20:14:07Z" -> null
- force_detach_policies = false -> null
- id = "forms-terraform-plan-workflow-dispatch" -> null
- managed_policy_arns = [
- "arn:aws:iam::687401027353:policy/OIDCPlanPolicy",
- "arn:aws:iam::aws:policy/ReadOnlyAccess",
] -> null
- max_session_duration = 3600 -> null
- name = "forms-terraform-plan-workflow-dispatch" -> null
- path = "/" -> null
- tags = {
- "CostCentre" = "forms-platform-staging"
- "Terraform" = "true"
} -> null
- tags_all = {
- "CostCentre" = "forms-platform-staging"
- "Terraform" = "true"
} -> null
- unique_id = "AROA2ADCLI4MRDFR6FQPT" -> null
}
# module.github_workflow_roles.aws_iam_role.this["platform-forms-client-release"] will be updated in-place
~ resource "aws_iam_role" "this" {
~ assume_role_policy = jsonencode(
~ {
~ Statement = [
~ {
~ Condition = {
~ StringLike = {
~ "token.actions.githubusercontent.com:sub" = "repo:cds-snc/platform-forms-client:release" -> "repo:cds-snc/platform-forms-client:ref:refs/tags/v*"
}
}
# (3 unchanged attributes hidden)
},
]
# (1 unchanged attribute hidden)
}
)
id = "platform-forms-client-release"
name = "platform-forms-client-release"
tags = {
"CostCentre" = "forms-platform-staging"
"Terraform" = "true"
}
# (8 unchanged attributes hidden)
}
Plan: 0 to add, 2 to change, 3 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Show Conftest resultsWARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.platform_forms_client_pr_review_env[0]"]
20 tests, 19 passed, 1 warning, 0 failures, 0 exceptions
|
bryan-robitaille
approved these changes
Jan 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Update the release OIDC roles to use tag references as GitHub does not consistently pass the workflow's event name as part of the role assume request.
Update the Terraform plan all workflow to use the default
forms-terraform-plan
role.Related