diff --git a/README.md b/README.md index 7cbc09d..07bb975 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ |------|------| | [aws_eks_addon.coredns](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_addon) | resource | | [aws_eks_addon.vpc_cni](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_addon) | resource | +| [aws_eks_identity_provider_config.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_identity_provider_config) | resource | | [aws_iam_policy.cert_manager](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | | [aws_iam_policy.cluster_autoscaler](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | | [aws_iam_policy.external_dns](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | @@ -54,12 +55,15 @@ | [core\_infra\_nodegroup\_instance\_types](#input\_core\_infra\_nodegroup\_instance\_types) | EC2 instance types to be used for the core infra EKS nodegroup | `string` | n/a | yes | | [core\_infra\_nodegroup\_max\_capacity](#input\_core\_infra\_nodegroup\_max\_capacity) | The maximum capacity for the EKS node group | `number` | n/a | yes | | [core\_infra\_nodegroup\_min\_capacity](#input\_core\_infra\_nodegroup\_min\_capacity) | The minimum capacity for the EKS node group | `number` | n/a | yes | +| [create\_timeout](#input\_create\_timeout) | value | `string` | `"60m"` | no | +| [delete\_timeout](#input\_delete\_timeout) | value | `string` | `"60m"` | no | | [disk\_size](#input\_disk\_size) | The desired capacity for the EKS node group | `number` | n/a | yes | | [main\_nodegroup\_desired\_capacity](#input\_main\_nodegroup\_desired\_capacity) | The desired capacity for the EKS node group | `number` | n/a | yes | | [main\_nodegroup\_instance\_types](#input\_main\_nodegroup\_instance\_types) | EC2 instance types to be used for the main EKS nodegroup | `string` | n/a | yes | | [main\_nodegroup\_max\_capacity](#input\_main\_nodegroup\_max\_capacity) | The maximum capacity for the EKS node group | `number` | n/a | yes | | [main\_nodegroup\_min\_capacity](#input\_main\_nodegroup\_min\_capacity) | The minimum capacity for the EKS node group | `number` | n/a | yes | | [map\_roles](#input\_map\_roles) | Additional IAM roles to add to the aws-auth configmap. |
list(object({
rolearn = string
username = string
groups = list(string)
}))
| n/a | yes | +| [org\_name](#input\_org\_name) | Organisation the EKS cluster should trust | `string` | n/a | yes | | [route53\_zone\_arn](#input\_route53\_zone\_arn) | The route53 zone ID for the cluster's domain | `string` | n/a | yes | | [subnets](#input\_subnets) | List of private subnet address ranges in CIDR format | `list(string)` | n/a | yes | | [vpc\_id](#input\_vpc\_id) | ID of the VPC to create the cluster in | `string` | n/a | yes | diff --git a/oidc.tf b/oidc.tf new file mode 100644 index 0000000..35a964d --- /dev/null +++ b/oidc.tf @@ -0,0 +1,18 @@ +resource "aws_eks_identity_provider_config" "this" { + depends_on = [ + module.eks + ] + cluster_name = var.cluster_name + + oidc { + client_id = "https://github.com/${var.org_name}" + identity_provider_config_name = "github-${var.org_name}" + issuer_url = "https://token.actions.githubusercontent.com" + username_claim = "repository" + } + + timeouts { + create = var.create_timeout + delete = var.delete_timeout + } +} diff --git a/test/main.tf b/test/main.tf index c00259e..305a63d 100644 --- a/test/main.tf +++ b/test/main.tf @@ -5,6 +5,7 @@ locals { vpc_cidr = "10.69.0.0/16" vpc_private_subnets = ["10.69.96.0/20", "10.69.112.0/20", "10.69.128.0/20"] vpc_public_subnets = ["10.69.144.0/20", "10.69.160.0/20", "10.69.176.0/20"] + org_name = "ministryofjustice" # Add more locals as required } @@ -31,6 +32,7 @@ module "eks_cluster" { core_infra_nodegroup_desired_capacity = 3 disk_size = 50 vpc_id = module.vpc.vpc_id + org_name = local.org_name # You will likely have to use a fake ARN here route53_zone_arn = "arn:aws:route53:::hostedzone/Z111XEXAMPLE9" diff --git a/variables.tf b/variables.tf index cad2786..e413c72 100644 --- a/variables.tf +++ b/variables.tf @@ -91,3 +91,20 @@ variable "route53_zone_arn" { description = "The route53 zone ID for the cluster's domain" type = string } + +variable "create_timeout" { + description = "value" + default = "60m" + type = string +} + +variable "delete_timeout" { + description = "value" + default = "60m" + type = string +} + +variable "org_name" { + description = "Organisation the EKS cluster should trust" + type = string +}