diff --git a/terraform/environments/apex/platform_providers.tf b/terraform/environments/apex/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/apex/platform_providers.tf +++ b/terraform/environments/apex/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/ccms-ebs-upgrade/platform_providers.tf b/terraform/environments/ccms-ebs-upgrade/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/ccms-ebs-upgrade/platform_providers.tf +++ b/terraform/environments/ccms-ebs-upgrade/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/ccms-ebs/platform_providers.tf b/terraform/environments/ccms-ebs/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/ccms-ebs/platform_providers.tf +++ b/terraform/environments/ccms-ebs/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/cdpt-chaps/platform_providers.tf b/terraform/environments/cdpt-chaps/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/cdpt-chaps/platform_providers.tf +++ b/terraform/environments/cdpt-chaps/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/cdpt-ifs/platform_providers.tf b/terraform/environments/cdpt-ifs/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/cdpt-ifs/platform_providers.tf +++ b/terraform/environments/cdpt-ifs/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/cica-copilot/platform_providers.tf b/terraform/environments/cica-copilot/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/cica-copilot/platform_providers.tf +++ b/terraform/environments/cica-copilot/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/cooker/platform_providers.tf b/terraform/environments/cooker/platform_providers.tf index fa546f4f1fa..7b8c9f4c6bb 100644 --- a/terraform/environments/cooker/platform_providers.tf +++ b/terraform/environments/cooker/platform_providers.tf @@ -56,3 +56,12 @@ provider "aws" { role_arn = "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureBedrockEuCentral" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/corporate-staff-rostering/platform_providers.tf b/terraform/environments/corporate-staff-rostering/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/corporate-staff-rostering/platform_providers.tf +++ b/terraform/environments/corporate-staff-rostering/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/cortex-xsiam/platform_providers.tf b/terraform/environments/cortex-xsiam/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/cortex-xsiam/platform_providers.tf +++ b/terraform/environments/cortex-xsiam/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/dacp/platform_providers.tf b/terraform/environments/dacp/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/dacp/platform_providers.tf +++ b/terraform/environments/dacp/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/data-and-insights-wepi/platform_providers.tf b/terraform/environments/data-and-insights-wepi/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/data-and-insights-wepi/platform_providers.tf +++ b/terraform/environments/data-and-insights-wepi/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/data-platform-apps-and-tools/platform_providers.tf b/terraform/environments/data-platform-apps-and-tools/platform_providers.tf index b0c24c0e1bf..3e8e5b06b63 100644 --- a/terraform/environments/data-platform-apps-and-tools/platform_providers.tf +++ b/terraform/environments/data-platform-apps-and-tools/platform_providers.tf @@ -68,4 +68,13 @@ provider "helm" { args = ["scripts/eks-authentication.sh", local.environment_management.account_ids[terraform.workspace], module.eks.cluster_name] } } -} \ No newline at end of file +} + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/data-platform-compute/platform_providers.tf b/terraform/environments/data-platform-compute/platform_providers.tf index 8d6085b9cb2..d86f55eba3b 100644 --- a/terraform/environments/data-platform-compute/platform_providers.tf +++ b/terraform/environments/data-platform-compute/platform_providers.tf @@ -38,3 +38,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/data-platform/platform_providers.tf b/terraform/environments/data-platform/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/data-platform/platform_providers.tf +++ b/terraform/environments/data-platform/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/delius-core/platform_providers.tf b/terraform/environments/delius-core/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/delius-core/platform_providers.tf +++ b/terraform/environments/delius-core/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/delius-iaps/platform_providers.tf b/terraform/environments/delius-iaps/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/delius-iaps/platform_providers.tf +++ b/terraform/environments/delius-iaps/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/delius-jitbit/platform_providers.tf b/terraform/environments/delius-jitbit/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/delius-jitbit/platform_providers.tf +++ b/terraform/environments/delius-jitbit/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/delius-mis/platform_providers.tf b/terraform/environments/delius-mis/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/delius-mis/platform_providers.tf +++ b/terraform/environments/delius-mis/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/digital-prison-reporting/platform_providers.tf b/terraform/environments/digital-prison-reporting/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/digital-prison-reporting/platform_providers.tf +++ b/terraform/environments/digital-prison-reporting/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/electronic-monitoring-data/platform_providers.tf b/terraform/environments/electronic-monitoring-data/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/electronic-monitoring-data/platform_providers.tf +++ b/terraform/environments/electronic-monitoring-data/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/equip/platform_providers.tf b/terraform/environments/equip/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/equip/platform_providers.tf +++ b/terraform/environments/equip/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/eric/platform_providers.tf b/terraform/environments/eric/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/eric/platform_providers.tf +++ b/terraform/environments/eric/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/example/identity_store.tf b/terraform/environments/example/identity_store.tf new file mode 100644 index 00000000000..8101b2d3c71 --- /dev/null +++ b/terraform/environments/example/identity_store.tf @@ -0,0 +1,13 @@ +data "aws_ssoadmin_instances" "example" { + provider = aws.sso-readonly +} + +data "aws_identitystore_group" "example" { + provider = aws.sso-readonly + identity_store_id = tolist(data.aws_ssoadmin_instances.example.identity_store_ids)[0] + + filter { + attribute_path = "DisplayName" + attribute_value = "modernisation-platform" + } +} \ No newline at end of file diff --git a/terraform/environments/example/platform_providers.tf b/terraform/environments/example/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/example/platform_providers.tf +++ b/terraform/environments/example/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/hmpps-domain-services/platform_providers.tf b/terraform/environments/hmpps-domain-services/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/hmpps-domain-services/platform_providers.tf +++ b/terraform/environments/hmpps-domain-services/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/hmpps-intelligence-management/platform_providers.tf b/terraform/environments/hmpps-intelligence-management/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/hmpps-intelligence-management/platform_providers.tf +++ b/terraform/environments/hmpps-intelligence-management/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/hmpps-oem/platform_providers.tf b/terraform/environments/hmpps-oem/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/hmpps-oem/platform_providers.tf +++ b/terraform/environments/hmpps-oem/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/laa-ccms-infra-azure-ad-sso/platform_providers.tf b/terraform/environments/laa-ccms-infra-azure-ad-sso/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/laa-ccms-infra-azure-ad-sso/platform_providers.tf +++ b/terraform/environments/laa-ccms-infra-azure-ad-sso/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/laa-oem/platform_providers.tf b/terraform/environments/laa-oem/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/laa-oem/platform_providers.tf +++ b/terraform/environments/laa-oem/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/long-term-storage/platform_providers.tf b/terraform/environments/long-term-storage/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/long-term-storage/platform_providers.tf +++ b/terraform/environments/long-term-storage/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/maat/platform_providers.tf b/terraform/environments/maat/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/maat/platform_providers.tf +++ b/terraform/environments/maat/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/maatdb/platform_providers.tf b/terraform/environments/maatdb/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/maatdb/platform_providers.tf +++ b/terraform/environments/maatdb/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/mlra/platform_providers.tf b/terraform/environments/mlra/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/mlra/platform_providers.tf +++ b/terraform/environments/mlra/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/mojfin/platform_providers.tf b/terraform/environments/mojfin/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/mojfin/platform_providers.tf +++ b/terraform/environments/mojfin/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/ncas/platform_providers.tf b/terraform/environments/ncas/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/ncas/platform_providers.tf +++ b/terraform/environments/ncas/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/nomis-combined-reporting/platform_providers.tf b/terraform/environments/nomis-combined-reporting/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/nomis-combined-reporting/platform_providers.tf +++ b/terraform/environments/nomis-combined-reporting/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/nomis-data-hub/platform_providers.tf b/terraform/environments/nomis-data-hub/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/nomis-data-hub/platform_providers.tf +++ b/terraform/environments/nomis-data-hub/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/nomis/platform_providers.tf b/terraform/environments/nomis/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/nomis/platform_providers.tf +++ b/terraform/environments/nomis/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/oas/platform_providers.tf b/terraform/environments/oas/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/oas/platform_providers.tf +++ b/terraform/environments/oas/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/oasys/platform_providers.tf b/terraform/environments/oasys/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/oasys/platform_providers.tf +++ b/terraform/environments/oasys/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/observability-platform/platform_providers.tf b/terraform/environments/observability-platform/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/observability-platform/platform_providers.tf +++ b/terraform/environments/observability-platform/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/performance-hub/platform_providers.tf b/terraform/environments/performance-hub/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/performance-hub/platform_providers.tf +++ b/terraform/environments/performance-hub/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/planetfm/platform_providers.tf b/terraform/environments/planetfm/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/planetfm/platform_providers.tf +++ b/terraform/environments/planetfm/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/portal/platform_providers.tf b/terraform/environments/portal/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/portal/platform_providers.tf +++ b/terraform/environments/portal/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/ppud/platform_providers.tf b/terraform/environments/ppud/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/ppud/platform_providers.tf +++ b/terraform/environments/ppud/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/pra-register/platform_providers.tf b/terraform/environments/pra-register/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/pra-register/platform_providers.tf +++ b/terraform/environments/pra-register/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/refer-monitor/platform_providers.tf b/terraform/environments/refer-monitor/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/refer-monitor/platform_providers.tf +++ b/terraform/environments/refer-monitor/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/sprinkler/platform_providers.tf b/terraform/environments/sprinkler/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/sprinkler/platform_providers.tf +++ b/terraform/environments/sprinkler/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/tariff/platform_providers.tf b/terraform/environments/tariff/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/tariff/platform_providers.tf +++ b/terraform/environments/tariff/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/tipstaff/platform_providers.tf b/terraform/environments/tipstaff/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/tipstaff/platform_providers.tf +++ b/terraform/environments/tipstaff/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/tribunals/platform_providers.tf b/terraform/environments/tribunals/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/tribunals/platform_providers.tf +++ b/terraform/environments/tribunals/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/wardship/platform_providers.tf b/terraform/environments/wardship/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/wardship/platform_providers.tf +++ b/terraform/environments/wardship/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +} diff --git a/terraform/environments/xhibit-portal/platform_providers.tf b/terraform/environments/xhibit-portal/platform_providers.tf index ac450a6ba4d..828f987c7aa 100644 --- a/terraform/environments/xhibit-portal/platform_providers.tf +++ b/terraform/environments/xhibit-portal/platform_providers.tf @@ -47,3 +47,12 @@ provider "aws" { role_arn = !can(regex("githubactionsrolesession|AdministratorAccess|user", data.aws_caller_identity.original_session.arn)) ? null : can(regex("user", data.aws_caller_identity.original_session.arn)) ? "arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:role/${var.collaborator_access}" : "arn:aws:iam::${data.aws_caller_identity.original_session.id}:role/MemberInfrastructureAccessUSEast" } } + +# Provider for reading resources from root account IdentityStore +provider "aws" { + region = "eu-west-2" + alias = "sso-readonly" + assume_role { + role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly" + } +}