Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 399ea677 authored by Kevin Coleman's avatar Kevin Coleman
Browse files

Expanding boostrap config

parent 2f8d3129
No related branches found
No related tags found
No related merge requests found
......@@ -144,6 +144,7 @@ module "argocd" {
source = "./kubernetes-addons/argocd"
argocd_helm_chart = var.argocd_helm_chart
argocd_applications = var.argocd_applications
eks_cluster_name = module.aws_eks.cluster_id
depends_on = [module.aws_eks]
}
......@@ -43,7 +43,8 @@ locals {
}
agones_helm_app = merge(
local.default_agones_helm_app,
var.agones_helm_chart)
var.agones_helm_chart
)
default_agones_helm_values = [templatefile("${path.module}/agones-values.yaml", {})]
......
......@@ -78,7 +78,6 @@ resource "helm_release" "prometheus" {
value = each_item.value.value
}
}
}
resource "aws_security_group_rule" "agones_sg_ingress_rule" {
......
data "aws_caller_identity" "current" {}
data "aws_region" "current" {}
\ No newline at end of file
......@@ -40,10 +40,50 @@ locals {
description = "The argocd HelmChart Ingress Controller deployment configuration"
postrender = ""
}
argocd_helm_app = merge(
local.default_argocd_helm_app,
var.argocd_helm_chart
)
default_argocd_helm_values = [templatefile("${path.module}/argocd-values.yaml", {})]
# Global Values for ArgoCD App of Apps.
global_values = {
region: data.aws_region.current.id
account: data.aws_caller_identity.current.account_id
clusterName: var.eks_cluster_name
agones: {
enable: true
}
awsForFluentBit: {
enable: true
}
awsLoadBalancerController: {
enable: true
}
calico: {
enable: true
}
certManager: {
enable: true
}
clusterAutoscaler: {
enable: true
}
externalDns: {
enable: true
}
metricsServer: {
enable: true
}
nginx: {
enable: true
}
prometheus: {
enable: true
}
traefik: {
enable: true
}
}
}
......@@ -79,6 +79,26 @@ resource "helm_release" "argocd" {
# ArgoCD App of Apps Bootstrapping
# ---------------------------------------------------------------------------------------------------------------------
// resource "kubernetes_manifest" "argocd_repository_secret" {
// for_each = var.argocd_applications
// manifest = {
// apiVersion: "v1"
// kind: "Secret"
// metadata: {
// name: each.key
// namespace: each.value.namespace
// labels: {
// "argocd.argoproj.io/secret-type": "repository"
// }
// }
// stringData: {
// url: each.value.repo_url
// sshPrivateKey: yamlencode(each.value.private_key)
// }
// }
// depends_on = [helm_release.argocd]
// }
resource "kubernetes_manifest" "argocd_application" {
for_each = var.argocd_applications
manifest = {
......@@ -96,7 +116,10 @@ resource "kubernetes_manifest" "argocd_application" {
project: each.value.project
source: {
helm: {
values: yamlencode(each.value.values)
values: yamlencode(merge(
each.value.values,
local.global_values
))
}
path: each.value.repo_path
repoURL: each.value.repo_url
......@@ -112,3 +135,34 @@ resource "kubernetes_manifest" "argocd_application" {
depends_on = [helm_release.argocd]
}
// resource "kubectl_manifest" "namespace" {
// yaml_body = yamlencode({
// apiVersion: "argoproj.io/v1alpha1"
// kind: "Application"
// metadata: {
// name: each.key
// namespace: each.value.namespace
// }
// spec: {
// destination: {
// namespace: each.value.namespace
// server: each.value.destination
// }
// project: each.value.project
// source: {
// helm: {
// values: yamlencode(each.value.values)
// }
// path: each.value.repo_path
// repoURL: each.value.repo_url
// targetRevision: each.value.target_revision
// }
// syncPolicy: {
// automated: {
// prune: true
// }
// }
// }
// })
// depends_on = [helm_release.argocd]
// }
......@@ -24,4 +24,9 @@ variable "argocd_helm_chart" {
variable "argocd_applications" {
type = any
default = {}
}
\ No newline at end of file
}
variable "eks_cluster_name" {
type = string
description = "Name for the EKS Cluster"
}
......@@ -22,7 +22,6 @@ variable "aws_for_fluentbit_helm_chart" {
default = {}
}
variable "eks_cluster_id" {
type = string
description = "EKS cluster Id"
......
......@@ -38,3 +38,10 @@ provider "helm" {
cluster_ca_certificate = var.create_eks ? base64decode(data.aws_eks_cluster.cluster.0.certificate_authority.0.data) : ""
}
}
provider "kubectl" {
host = var.create_eks ? data.aws_eks_cluster.cluster.0.endpoint : ""
token = var.create_eks ? data.aws_eks_cluster_auth.cluster.0.token : ""
cluster_ca_certificate = var.create_eks ? base64decode(data.aws_eks_cluster.cluster.0.certificate_authority.0.data) : ""
load_config_file = false
}
......@@ -42,6 +42,10 @@ terraform {
source = "terraform-aws-modules/http"
version = "2.4.1"
}
kubectl = {
source = "gavinbunney/kubectl"
version = ">= 1.7.0"
}
}
required_version = ">= 1.0.0"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment