Skip to content

Commit 545b7f0

Browse files
authored
Merge pull request #94 from commitdev/misc-other-fixes
Some other fixes from using commit0 for a real project
2 parents 50d7436 + 0ff24af commit 545b7f0

File tree

8 files changed

+30
-12
lines changed

8 files changed

+30
-12
lines changed

internal/api/create_project.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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) {

templates/commit0/commit0.tmpl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff 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

3028
services:
3129
{{range .Services}}

templates/kubernetes/terraform/modules/kubernetes/monitoring/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ data "aws_iam_policy" "CloudWatchAgentServerPolicy" {
1919
}
2020

2121
resource "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
}

templates/kubernetes/terraform/modules/kubernetes/provider.tf

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ data "aws_eks_cluster" "cluster" {
55
}
66

77
data "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

1115
provider "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+
}

templates/kubernetes/terraform/modules/kubernetes/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ variable "external_dns_owner_id" {
2323
}
2424

2525
variable "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
}

templates/terraform/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,9 @@
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>`

templates/terraform/modules/s3_hosting/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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
7177
data "aws_acm_certificate" "wildcard_cert" {
78+
provider = "aws.east1"
7279
domain = var.cert_domain
7380
most_recent = "true"
7481
}

templates/terraform/modules/vpc/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)