Skip to content

Commit fbe64df

Browse files
Merge pull request #2 from terraform-aws-modules/fix/git_hooks_and_ci
fixing up CI and git hooks
2 parents 67d2946 + 2e7897b commit fbe64df

File tree

5 files changed

+137
-139
lines changed

5 files changed

+137
-139
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Please explain the changes you made here and link to any relevant issues.
66

77
### Checklist
88

9-
* [ ] `terraform fmt` and `terraform validate` both work from the root and `examples/alb_test_fixture` directories (look in CI for an example)
10-
* [ ] Tests for the changes have been added and passing (for bug fixes/features)
11-
* [ ] Test results are pasted in this PR (in lieu of CI)
12-
* [ ] Docs have been added/updated (for bug fixes/features)
13-
* [ ] Any breaking changes are noted in the description above
9+
- [ ] `terraform fmt` and `terraform validate` both work from the root and `examples/eks_test_fixture` directories (look in CI for an example)
10+
- [ ] Tests for the changes have been added and passing (for bug fixes/features)
11+
- [ ] Test results are pasted in this PR (in lieu of CI)
12+
- [ ] Docs have been added/updated (for bug fixes/features)
13+
- [ ] Any breaking changes are noted in the description above

.pre-commit-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
repos:
44
- repo: git://github.com/antonbabenko/pre-commit-terraform
55
rev: v1.7.1
6-
sha: 091f8b15d7b458e5a0aca642483deb2205e7db02
76
hooks:
87
- id: terraform_fmt
98
# - id: terraform_docs
109
- repo: git://github.com/pre-commit/pre-commit-hooks
1110
rev: v1.2.3
12-
sha: 92e1570c282e3c69a1f8b5b8dd8d286fe27cfaa7
1311
hooks:
1412
- id: check-merge-conflict
1513
- id: trailing-whitespace

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ script:
2626
- echo 'script'
2727
- terraform init
2828
- terraform fmt -check=true
29-
- terraform validate -var "region=${AWS_REGION}" -var "vpc_id=vpc-123456" -var "subnets=['subnet-12345a']" -var "workers_ami_id=ami-123456" -var "cluster_ingress_cidrs=[]" -var "cluster_name=test_cluster"
29+
- terraform validate -var "region=${AWS_REGION}" -var "vpc_id=vpc-123456" -var "subnets=[\"subnet-12345a\"]" -var "workers_ami_id=ami-123456" -var "cluster_ingress_cidrs=[]" -var "cluster_name=test_cluster"
3030
- docker run --rm -v $(pwd):/app/ --workdir=/app/ -t wata727/tflint --error-with-issues
3131
- cd examples/eks_test_fixture
3232
- terraform init

local.tf

Lines changed: 130 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,130 @@
1-
locals {
2-
# Mapping from the node type that we selected and the max number of pods that it can run
3-
# Taken from https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-06-05/amazon-eks-nodegroup.yaml
4-
max_pod_per_node = {
5-
c4.large = 29
6-
c4.xlarge = 58
7-
c4.2xlarge = 58
8-
c4.4xlarge = 234
9-
c4.8xlarge = 234
10-
c5.large = 29
11-
c5.xlarge = 58
12-
c5.2xlarge = 58
13-
c5.4xlarge = 234
14-
c5.9xlarge = 234
15-
c5.18xlarge = 737
16-
i3.large = 29
17-
i3.xlarge = 58
18-
i3.2xlarge = 58
19-
i3.4xlarge = 234
20-
i3.8xlarge = 234
21-
i3.16xlarge = 737
22-
m3.medium = 12
23-
m3.large = 29
24-
m3.xlarge = 58
25-
m3.2xlarge = 118
26-
m4.large = 20
27-
m4.xlarge = 58
28-
m4.2xlarge = 58
29-
m4.4xlarge = 234
30-
m4.10xlarge = 234
31-
m5.large = 29
32-
m5.xlarge = 58
33-
m5.2xlarge = 58
34-
m5.4xlarge = 234
35-
m5.12xlarge = 234
36-
m5.24xlarge = 737
37-
p2.xlarge = 58
38-
p2.8xlarge = 234
39-
p2.16xlarge = 234
40-
p3.2xlarge = 58
41-
p3.8xlarge = 234
42-
p3.16xlarge = 234
43-
r3.xlarge = 58
44-
r3.2xlarge = 58
45-
r3.4xlarge = 234
46-
r3.8xlarge = 234
47-
r4.large = 29
48-
r4.xlarge = 58
49-
r4.2xlarge = 58
50-
r4.4xlarge = 234
51-
r4.8xlarge = 234
52-
r4.16xlarge = 737
53-
t2.small = 8
54-
t2.medium = 17
55-
t2.large = 35
56-
t2.xlarge = 44
57-
t2.2xlarge = 44
58-
x1.16xlarge = 234
59-
x1.32xlarge = 234
60-
}
61-
62-
asg_tags = ["${null_resource.tags_as_list_of_maps.*.triggers}"]
63-
64-
# More information: https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-06-05/amazon-eks-nodegroup.yaml
65-
workers_userdata = <<USERDATA
66-
#!/bin/bash -xe
67-
68-
CA_CERTIFICATE_DIRECTORY=/etc/kubernetes/pki
69-
CA_CERTIFICATE_FILE_PATH=$CA_CERTIFICATE_DIRECTORY/ca.crt
70-
mkdir -p $CA_CERTIFICATE_DIRECTORY
71-
echo "${aws_eks_cluster.this.certificate_authority.0.data}" | base64 -d > $CA_CERTIFICATE_FILE_PATH
72-
INTERNAL_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
73-
sed -i s,MASTER_ENDPOINT,${aws_eks_cluster.this.endpoint},g /var/lib/kubelet/kubeconfig
74-
sed -i s,CLUSTER_NAME,${var.cluster_name},g /var/lib/kubelet/kubeconfig
75-
sed -i s,REGION,${data.aws_region.current.name},g /etc/systemd/system/kubelet.service
76-
sed -i s,MAX_PODS,${lookup(local.max_pod_per_node, var.workers_instance_type)},g /etc/systemd/system/kubelet.service
77-
sed -i s,MASTER_ENDPOINT,${aws_eks_cluster.this.endpoint},g /etc/systemd/system/kubelet.service
78-
sed -i s,INTERNAL_IP,$INTERNAL_IP,g /etc/systemd/system/kubelet.service
79-
DNS_CLUSTER_IP=10.100.0.10
80-
if [[ $INTERNAL_IP == 10.* ]] ; then DNS_CLUSTER_IP=172.20.0.10; fi
81-
sed -i s,DNS_CLUSTER_IP,$DNS_CLUSTER_IP,g /etc/systemd/system/kubelet.service
82-
sed -i s,CERTIFICATE_AUTHORITY_FILE,$CA_CERTIFICATE_FILE_PATH,g /var/lib/kubelet/kubeconfig
83-
sed -i s,CLIENT_CA_FILE,$CA_CERTIFICATE_FILE_PATH,g /etc/systemd/system/kubelet.service
84-
systemctl daemon-reload
85-
systemctl restart kubelet kube-proxy
86-
USERDATA
87-
88-
config_map_aws_auth = <<CONFIGMAPAWSAUTH
89-
apiVersion: v1
90-
kind: ConfigMap
91-
metadata:
92-
name: aws-auth
93-
namespace: kube-system
94-
data:
95-
mapRoles: |
96-
- rolearn: ${aws_iam_role.workers.arn}
97-
username: system:node:{{EC2PrivateDNSName}}
98-
groups:
99-
- system:bootstrappers
100-
- system:nodes
101-
CONFIGMAPAWSAUTH
102-
103-
kubeconfig = <<KUBECONFIG
104-
105-
apiVersion: v1
106-
clusters:
107-
- cluster:
108-
server: ${aws_eks_cluster.this.endpoint}
109-
certificate-authority-data: ${aws_eks_cluster.this.certificate_authority.0.data}
110-
name: kubernetes
111-
contexts:
112-
- context:
113-
cluster: kubernetes
114-
user: aws
115-
name: aws
116-
current-context: aws
117-
kind: Config
118-
preferences: {}
119-
users:
120-
- name: aws
121-
user:
122-
exec:
123-
apiVersion: client.authentication.k8s.io/v1alpha1
124-
command: heptio-authenticator-aws
125-
args:
126-
- "token"
127-
- "-i"
128-
- "${var.cluster_name}"
129-
KUBECONFIG
130-
}
1+
locals {
2+
# Mapping from the node type that we selected and the max number of pods that it can run
3+
# Taken from https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-06-05/amazon-eks-nodegroup.yaml
4+
max_pod_per_node = {
5+
c4.large = 29
6+
c4.xlarge = 58
7+
c4.2xlarge = 58
8+
c4.4xlarge = 234
9+
c4.8xlarge = 234
10+
c5.large = 29
11+
c5.xlarge = 58
12+
c5.2xlarge = 58
13+
c5.4xlarge = 234
14+
c5.9xlarge = 234
15+
c5.18xlarge = 737
16+
i3.large = 29
17+
i3.xlarge = 58
18+
i3.2xlarge = 58
19+
i3.4xlarge = 234
20+
i3.8xlarge = 234
21+
i3.16xlarge = 737
22+
m3.medium = 12
23+
m3.large = 29
24+
m3.xlarge = 58
25+
m3.2xlarge = 118
26+
m4.large = 20
27+
m4.xlarge = 58
28+
m4.2xlarge = 58
29+
m4.4xlarge = 234
30+
m4.10xlarge = 234
31+
m5.large = 29
32+
m5.xlarge = 58
33+
m5.2xlarge = 58
34+
m5.4xlarge = 234
35+
m5.12xlarge = 234
36+
m5.24xlarge = 737
37+
p2.xlarge = 58
38+
p2.8xlarge = 234
39+
p2.16xlarge = 234
40+
p3.2xlarge = 58
41+
p3.8xlarge = 234
42+
p3.16xlarge = 234
43+
r3.xlarge = 58
44+
r3.2xlarge = 58
45+
r3.4xlarge = 234
46+
r3.8xlarge = 234
47+
r4.large = 29
48+
r4.xlarge = 58
49+
r4.2xlarge = 58
50+
r4.4xlarge = 234
51+
r4.8xlarge = 234
52+
r4.16xlarge = 737
53+
t2.small = 8
54+
t2.medium = 17
55+
t2.large = 35
56+
t2.xlarge = 44
57+
t2.2xlarge = 44
58+
x1.16xlarge = 234
59+
x1.32xlarge = 234
60+
}
61+
62+
asg_tags = ["${null_resource.tags_as_list_of_maps.*.triggers}"]
63+
64+
# More information: https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-06-05/amazon-eks-nodegroup.yaml
65+
workers_userdata = <<USERDATA
66+
#!/bin/bash -xe
67+
68+
CA_CERTIFICATE_DIRECTORY=/etc/kubernetes/pki
69+
CA_CERTIFICATE_FILE_PATH=$CA_CERTIFICATE_DIRECTORY/ca.crt
70+
mkdir -p $CA_CERTIFICATE_DIRECTORY
71+
echo "${aws_eks_cluster.this.certificate_authority.0.data}" | base64 -d > $CA_CERTIFICATE_FILE_PATH
72+
INTERNAL_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
73+
sed -i s,MASTER_ENDPOINT,${aws_eks_cluster.this.endpoint},g /var/lib/kubelet/kubeconfig
74+
sed -i s,CLUSTER_NAME,${var.cluster_name},g /var/lib/kubelet/kubeconfig
75+
sed -i s,REGION,${data.aws_region.current.name},g /etc/systemd/system/kubelet.service
76+
sed -i s,MAX_PODS,${lookup(local.max_pod_per_node, var.workers_instance_type)},g /etc/systemd/system/kubelet.service
77+
sed -i s,MASTER_ENDPOINT,${aws_eks_cluster.this.endpoint},g /etc/systemd/system/kubelet.service
78+
sed -i s,INTERNAL_IP,$INTERNAL_IP,g /etc/systemd/system/kubelet.service
79+
DNS_CLUSTER_IP=10.100.0.10
80+
if [[ $INTERNAL_IP == 10.* ]] ; then DNS_CLUSTER_IP=172.20.0.10; fi
81+
sed -i s,DNS_CLUSTER_IP,$DNS_CLUSTER_IP,g /etc/systemd/system/kubelet.service
82+
sed -i s,CERTIFICATE_AUTHORITY_FILE,$CA_CERTIFICATE_FILE_PATH,g /var/lib/kubelet/kubeconfig
83+
sed -i s,CLIENT_CA_FILE,$CA_CERTIFICATE_FILE_PATH,g /etc/systemd/system/kubelet.service
84+
systemctl daemon-reload
85+
systemctl restart kubelet kube-proxy
86+
USERDATA
87+
88+
config_map_aws_auth = <<CONFIGMAPAWSAUTH
89+
apiVersion: v1
90+
kind: ConfigMap
91+
metadata:
92+
name: aws-auth
93+
namespace: kube-system
94+
data:
95+
mapRoles: |
96+
- rolearn: ${aws_iam_role.workers.arn}
97+
username: system:node:{{EC2PrivateDNSName}}
98+
groups:
99+
- system:bootstrappers
100+
- system:nodes
101+
CONFIGMAPAWSAUTH
102+
103+
kubeconfig = <<KUBECONFIG
104+
105+
apiVersion: v1
106+
clusters:
107+
- cluster:
108+
server: ${aws_eks_cluster.this.endpoint}
109+
certificate-authority-data: ${aws_eks_cluster.this.certificate_authority.0.data}
110+
name: kubernetes
111+
contexts:
112+
- context:
113+
cluster: kubernetes
114+
user: aws
115+
name: aws
116+
current-context: aws
117+
kind: Config
118+
preferences: {}
119+
users:
120+
- name: aws
121+
user:
122+
exec:
123+
apiVersion: client.authentication.k8s.io/v1alpha1
124+
command: heptio-authenticator-aws
125+
args:
126+
- "token"
127+
- "-i"
128+
- "${var.cluster_name}"
129+
KUBECONFIG
130+
}

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.1.0
1+
v0.1.1

0 commit comments

Comments
 (0)