Commit 73ed011a authored by Jose Ernesto Suarez's avatar Jose Ernesto Suarez

Trying to add route53 certmanager

parent 1b703fda
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "route53:GetChange",
"Resource": "arn:aws:route53:::change/*"
},
{
"Effect": "Allow",
"Action": [
"route53:ChangeResourceRecordSets",
"route53:ListResourceRecordSets"
],
"Resource": "arn:aws:route53:::hostedzone/${hostedzone}"
}
]
}
...@@ -86,7 +86,7 @@ locals { ...@@ -86,7 +86,7 @@ locals {
namespace = "ingress-nginx" namespace = "ingress-nginx"
chart = "ingress-nginx" chart = "ingress-nginx"
repository = "https://kubernetes.github.io/ingress-nginx" repository = "https://kubernetes.github.io/ingress-nginx"
version = "4.5.2" version = "4.6.0"
max_history = 3, max_history = 3,
values = { values = {
file = [ file = [
...@@ -165,6 +165,19 @@ locals { ...@@ -165,6 +165,19 @@ locals {
} }
} }
} }
gitlab = {
namespace = "gitlab"
chart = "gitlab"
repository = "https://charts.gitlab.io/"
version = "13.6.0"
max_history = 3,
force = true,
values = {
file = [],
set = {}
}
}
} }
# extend the default settings with provided values # extend the default settings with provided values
......
...@@ -36,11 +36,43 @@ resource "aws_iam_role_policy_attachment" "autoscaler" { ...@@ -36,11 +36,43 @@ resource "aws_iam_role_policy_attachment" "autoscaler" {
policy_arn = aws_iam_policy.cluster_autoscaler.arn policy_arn = aws_iam_policy.cluster_autoscaler.arn
} }
resource "aws_iam_policy" "cluster_autoscaler" { resource "aws_iam_policy" "cluster_autoscaler" {
name_prefix = "cluster-autoscaler" name_prefix = "cluster-autoscaler"
description = "EKS cluster-autoscaler policy for cluster ${var.cluster_name}" description = "EKS cluster-autoscaler policy for cluster ${var.cluster_name}"
policy = data.aws_iam_policy_document.cluster_autoscaler.json policy = data.aws_iam_policy_document.cluster_autoscaler.json
} }
resource "aws_iam_role" "cert_manager" {
name = "${var.cluster_name}-cert-manager"
assume_role_policy = jsonencode({
Statement = [{
Action = "sts:AssumeRole"
Effect = "Allow"
Principal = {
"AWS" = aws_iam_role.node.arn
}
}]
Version = "2012-10-17"
})
}
resource "aws_iam_role_policy_attachment" "cert_manager" {
role = aws_iam_role.node.name
policy_arn = aws_iam_policy.cert_manager.arn
}
resource "aws_iam_policy" "cert_manager" {
name_prefix = "cert_manager"
description = "EKS Cert-Manager policy for cluster ${var.cluster_name} with route53 ${var.route53_hostedzone}"
policy = data.template_file.cert_manager_policy.rendered
}
data "template_file" "cert_manager_policy" {
template = "${file("${path.module}/files/cert_manager_policy.json.tpl")}"
vars = {
hostedzone = var.route53_hostedzone,
}
}
data "aws_iam_policy_document" "cluster_autoscaler" { data "aws_iam_policy_document" "cluster_autoscaler" {
statement { statement {
......
...@@ -8,6 +8,11 @@ output "cluster_iam_role_arn" { ...@@ -8,6 +8,11 @@ output "cluster_iam_role_arn" {
value = aws_iam_role.cluster.arn value = aws_iam_role.cluster.arn
} }
output "cluster_cert_manager_iam_role_arn" {
description = "IAM role arn of the Cert Manager"
value = aws_iam_role.cert_manager.arn
}
output "cluster_sg_id" { output "cluster_sg_id" {
description = "Security group used within the cluster" description = "Security group used within the cluster"
value = aws_security_group.cluster.id value = aws_security_group.cluster.id
......
...@@ -120,6 +120,7 @@ variable "ingresses" { ...@@ -120,6 +120,7 @@ variable "ingresses" {
default = [] default = []
} }
########## ##########
# K8S APPS # K8S APPS
########## ##########
...@@ -133,6 +134,15 @@ variable "istio" { ...@@ -133,6 +134,15 @@ variable "istio" {
type = any type = any
default = { enabled = false, version = "", set = {} } default = { enabled = false, version = "", set = {} }
} }
## ROLE FOR CERTMANAGER
# TODO: NEEDS TO ADD CONDITIONAL CREATION!!
variable "route53_hostedzone" {
description = "Route53 Hosted Zone managed by the certmanager of this cluster"
type = string
}
#variable "istio_enable" { #variable "istio_enable" {
# description = "Flag to enable Istio" # description = "Flag to enable Istio"
# type = bool # type = bool
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment