Separate Terraform plan and apply roles for incubator#147
Open
Benettonkkb wants to merge 1 commit intomainfrom
Open
Separate Terraform plan and apply roles for incubator#147Benettonkkb wants to merge 1 commit intomainfrom
Benettonkkb wants to merge 1 commit intomainfrom
Conversation
|
Terraform plan in terraform Plan: 4 to add, 0 to change, 0 to destroy.Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_iam_role.incubator_tf_apply will be created
+ resource "aws_iam_role" "incubator_tf_apply" {
+ arn = (known after apply)
+ assume_role_policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "sts:AssumeRoleWithWebIdentity"
+ Condition = {
+ StringEquals = {
+ "token.actions.githubusercontent.com:aud" = "*****************"
}
+ StringLike = {
+ "token.actions.githubusercontent.com:sub" = "********************************************"
}
}
+ Effect = "Allow"
+ Principal = {
+ Federated = "arn:aws:iam::035866691871:oidc-provider/token.actions.githubusercontent.com"
}
},
]
+ Version = "2012-10-17"
}
)
+ create_date = (known after apply)
+ force_detach_policies = false
+ id = (known after apply)
+ managed_policy_arns = (known after apply)
+ max_session_duration = 3600
+ name = "incubator-tf-apply"
+ name_prefix = (known after apply)
+ path = "/"
+ tags_all = (known after apply)
+ unique_id = (known after apply)
+ inline_policy (known after apply)
}
# aws_iam_role_policy_attachment.incubator_tf_apply_admin will be created
+ resource "aws_iam_role_policy_attachment" "incubator_tf_apply_admin" {
+ id = (known after apply)
+ policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
+ role = "incubator-tf-apply"
}
# module.iam_oidc_incubator_tf_plan.aws_iam_openid_connect_provider.github_actions will be created
+ resource "aws_iam_openid_connect_provider" "github_actions" {
+ arn = (known after apply)
+ client_id_list = [
+ "sts.amazonaws.com",
]
+ id = (known after apply)
+ tags_all = (known after apply)
+ thumbprint_list = [
+ "2b18947a6a9fc7764fd8b5fb18a863b0c6dac24f",
]
+ url = "https://token.actions.githubusercontent.com"
}
# module.iam_oidc_incubator_tf_plan.aws_iam_role.github_actions_oidc will be created
+ resource "aws_iam_role" "github_actions_oidc" {
+ arn = (known after apply)
+ assume_role_policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "sts:AssumeRoleWithWebIdentity"
+ Condition = {
+ StringEquals = {
+ "token.actions.githubusercontent.com:aud" = "*****************"
}
+ StringLike = {
+ "token.actions.githubusercontent.com:sub" = [
+ "repo:hackforla/incubator:ref:refs/heads/*",
+ "repo:hackforla/incubator:pull_request",
]
}
}
+ Effect = "Allow"
+ Principal = {
+ Federated = "arn:aws:iam::035866691871:oidc-provider/token.actions.githubusercontent.com"
}
},
]
+ Version = "2012-10-17"
}
)
+ create_date = (known after apply)
+ force_detach_policies = false
+ id = (known after apply)
+ managed_policy_arns = [
+ "arn:aws:iam::aws:policy/ReadOnlyAccess",
]
+ max_session_duration = 3600
+ name = "incubator-tf-plan"
+ name_prefix = (known after apply)
+ path = "/"
+ tags_all = (known after apply)
+ unique_id = (known after apply)
+ inline_policy (known after apply)
}
Plan: 4 to add, 0 to change, 0 to destroy.
Warning: Argument is deprecated
with module.iam_oidc_incubator_tf_plan.aws_iam_role.github_actions_oidc,
on modules/aws-gha-oidc-providers/main.tf line 54, in resource "aws_iam_role" "github_actions_oidc":
54: managed_policy_arns = var.policy_arns
managed_policy_arns is deprecated. Use the aws_iam_role_policy_attachment
resource instead. If Terraform should exclusively manage all managed policy
attachments (the current behavior of this argument), use the
aws_iam_role_policy_attachments_exclusive resource as well.📝 Plan generated in Write Terraform Plan to Pull Request #92 |
Member
Author
This file contains hidden or 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
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.

Fixes #146
What changes did you make?
incubator-tf-planwith ReadOnlyAccess for Terraform plan jobs.incubator-tf-applywith AdministratorAccess and a trust policy restricted to repo:hackforla/incubator:ref:refs/heads/main(in consideration of IAM best practices).Why did you make the changes (we will use this info to test)?
policy_arns = ["arn:aws:iam::aws:policy/AdministratorAccess" ]in the same wayiam_oidc_gha_incubatordoes to separate the privilege definitions(I believe I understand this correctly- open to being corrected).