File tree Expand file tree Collapse file tree 8 files changed +30
-12
lines changed
kubernetes/terraform/modules/kubernetes Expand file tree Collapse file tree 8 files changed +30
-12
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ func createProject(projectConfig util.ProjectConfiguration) string {
1818 t := templator .NewTemplator (templates )
1919 outDir := "./"
2020 rootDir := path .Join (outDir , projectConfig .ProjectName )
21- log .Printf ("Creating project %s." , projectConfig )
21+ log .Printf ("Creating project %s." , projectConfig . ProjectName )
2222 err := os .MkdirAll (rootDir , os .ModePerm )
2323
2424 if os .IsExist (err ) {
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ infrastructure:
1212 accountId: {{ .Infrastructure.AWS.AccountID }}
1313 region: {{ .Infrastructure.AWS.Region }}
1414 eks:
15- clusterName: staging
15+ clusterName: {{.ProjectName}}- staging-{{ .Infrastructure.AWS.Region }}
1616 cognito:
1717 enabled: true
1818 s3Hosting:
@@ -24,8 +24,6 @@ frontend:
2424 system: github
2525 app:
2626 name: {{.ProjectName }}
27- app:
28- name: {{.FrontendHostname }}
2927
3028services:
3129 {{range .Services}}
Original file line number Diff line number Diff line change @@ -19,6 +19,6 @@ data "aws_iam_policy" "CloudWatchAgentServerPolicy" {
1919}
2020
2121resource "aws_iam_role_policy_attachment" "k8s_monitoring_role_policy" {
22- role = " ${ aws_iam_role . k8s_monitoring . id } "
23- policy_arn = " ${ data . aws_iam_policy . CloudWatchAgentServerPolicy . arn } "
22+ role = aws_iam_role. k8s_monitoring . id
23+ policy_arn = data. aws_iam_policy . CloudWatchAgentServerPolicy . arn
2424}
Original file line number Diff line number Diff line change @@ -5,12 +5,16 @@ data "aws_eks_cluster" "cluster" {
55}
66
77data "aws_eks_cluster_auth" "cluster_auth" {
8- name = " ${ data . aws_eks_cluster . cluster . name } "
8+ name = data. aws_eks_cluster . cluster . name
9+ }
10+
11+ provider "aws" {
12+ region = var. region
913}
1014
1115provider "kubernetes" {
12- host = " ${ data . aws_eks_cluster . cluster . endpoint } "
13- cluster_ca_certificate = " ${ base64decode (data. aws_eks_cluster . cluster . certificate_authority . 0 . data )} "
14- token = " ${ data . aws_eks_cluster_auth . cluster_auth . token } "
16+ host = data. aws_eks_cluster . cluster . endpoint
17+ cluster_ca_certificate = base64decode (data. aws_eks_cluster . cluster . certificate_authority . 0 . data )
18+ token = data. aws_eks_cluster_auth . cluster_auth . token
1519 load_config_file = false
16- }
20+ }
Original file line number Diff line number Diff line change @@ -23,6 +23,6 @@ variable "external_dns_owner_id" {
2323}
2424
2525variable "external_dns_assume_roles" {
26- type = " list"
2726 description = " List of roles that should be able to assume the external dns role (most likely the role of the cluster worker nodes)"
27+ type = list (string )
2828}
Original file line number Diff line number Diff line change 9393 environment/development$ terraform init
9494 environment/development$ terraform plan
9595 ```
96+
97+ ## To use kubectl with the created EKS cluster:
98+
99+ Exchange your aws credentials for kubernetes credentials.
100+ This will add a new context to your kubeconfig.
101+ ` aws eks update-kubeconfig --name <cluster name> --region <aws region> `
Original file line number Diff line number Diff line change @@ -67,8 +67,15 @@ resource "aws_s3_bucket_policy" "client_assets" {
6767 policy = data. aws_iam_policy_document . assets_origin [each . value ]. json
6868}
6969
70+ # To use an ACM cert with CF it has to exist in us-east-1
71+ provider "aws" {
72+ region = " us-east-1"
73+ alias = " east1"
74+ }
75+
7076# Find an already created ACM cert for this domain
7177data "aws_acm_certificate" "wildcard_cert" {
78+ provider = " aws.east1"
7279 domain = var. cert_domain
7380 most_recent = " true"
7481}
Original file line number Diff line number Diff line change @@ -31,4 +31,7 @@ module "vpc" {
3131 environment = var.environment
3232 }
3333
34+ vpc_tags = {
35+ " kubernetes.io/cluster/${var.kubernetes_cluster_name}" = " shared"
36+ }
3437}
You can’t perform that action at this time.
0 commit comments