Skip to content

Commit

Permalink
Merge pull request #1281 from Crown-Commercial-Service/dmp-1-0-cicd-i…
Browse files Browse the repository at this point in the history
…nfra-allow

Add IAM role to allow DMP 1.0 Jenkins to talk to DMP 1.0 accounts via…
  • Loading branch information
ghill95 authored Nov 20, 2023
2 parents 4cec863 + 4af907f commit 31d5809
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
17 changes: 17 additions & 0 deletions terraform/accounts/main/jenkins_instance_profile.tf
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,20 @@ resource "aws_iam_role_policy" "jenkins_assume_cloudtrail_validate_logs" {
policy = data.aws_iam_policy_document.jenkins_assume_cloudtrail_validate_logs.json
}

resource "aws_iam_policy" "dmp_1_0_jenkins_cicd_infrastructure_role_policy" {
name = "dmp_1_0_jenkins_cicd_infrastructure_role_policy"
policy = data.aws_iam_policy_document.dmp_1_0_jenkins_cicd_infrastructure_role_policy.json
}

data "aws_iam_policy_document" "dmp_1_0_jenkins_cicd_infrastructure_role_policy" {
statement {
sid = "Statement1"
actions = ["sts:AssumeRole"]

resources = [
"arn:aws:iam::${var.aws_sandbox_account_id}:role/cicd_infrastructure",
"arn:aws:iam::${var.aws_dev_account_id}:role/cicd_infrastructure",
"arn:aws:iam::${var.aws_staging_account_id}:role/cicd_infrastructure"
]
}
}
6 changes: 6 additions & 0 deletions terraform/accounts/main/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ variable "aws_sub_account_ids" {
variable "aws_dev_account_id" {
}

variable "aws_sandbox_account_id" {
}

variable "aws_staging_account_id" {
}

variable "aws_backups_account_id" {
}

Expand Down

0 comments on commit 31d5809

Please sign in to comment.