Skip to content

Commit 525cdcc

Browse files
authored
Merge pull request #2 from truefoundry/tag-support
Added tagging support and versioning
2 parents 8585237 + da71708 commit 525cdcc

File tree

5 files changed

+59
-17
lines changed

5 files changed

+59
-17
lines changed

.github/workflows/tflint.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Lint
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
tflint:
9+
runs-on: ${{ matrix.os }}
10+
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
name: Checkout source code
18+
19+
- uses: actions/cache@v3
20+
name: Cache plugin dir
21+
with:
22+
path: ~/.tflint.d/plugins
23+
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
24+
25+
- uses: terraform-linters/setup-tflint@v3
26+
name: Setup TFLint
27+
with:
28+
tflint_version: v0.47.0
29+
30+
- name: Show version
31+
run: tflint --version
32+
33+
- name: Init TFLint
34+
run: tflint --init
35+
env:
36+
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
37+
GITHUB_TOKEN: ${{ github.token }}
38+
39+
- name: Run TFLint
40+
run: tflint --minimum-failure-severity=error -f compact

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ Truefoundry AWS Karpenter Module
44
<!-- BEGIN_TF_DOCS -->
55
## Requirements
66

7-
No requirements.
7+
| Name | Version |
8+
|------|---------|
9+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.4 |
10+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | 5.17.0 |
811

912
## Providers
1013

1114
| Name | Version |
1215
|------|---------|
13-
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |
16+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.17.0 |
1417

1518
## Modules
1619

@@ -22,14 +25,12 @@ No requirements.
2225

2326
| Name | Type |
2427
|------|------|
25-
| [aws_iam_instance_profile.karpenter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_instance_profile) | resource |
26-
| [aws_eks_cluster.cluster](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster) | data source |
28+
| [aws_iam_instance_profile.karpenter](https://registry.terraform.io/providers/hashicorp/aws/5.17.0/docs/resources/iam_instance_profile) | resource |
2729

2830
## Inputs
2931

3032
| Name | Description | Type | Default | Required |
3133
|------|-------------|------|---------|:--------:|
32-
| <a name="input_account_name"></a> [account\_name](#input\_account\_name) | AWS Account Name | `string` | n/a | yes |
3334
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Cluster Name to install karpenter | `string` | n/a | yes |
3435
| <a name="input_controller_node_iam_role_arn"></a> [controller\_node\_iam\_role\_arn](#input\_controller\_node\_iam\_role\_arn) | The initial node iam role arn | `string` | n/a | yes |
3536
| <a name="input_controller_nodegroup_name"></a> [controller\_nodegroup\_name](#input\_controller\_nodegroup\_name) | The initial nodegroup name | `string` | n/a | yes |

main.tf

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
# From https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/examples/irsa/irsa.tf
2-
3-
data "aws_eks_cluster" "cluster" {
4-
name = var.cluster_name
5-
}
6-
72
module "karpenter_irsa_role" {
8-
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
9-
version = "5.27.0"
3+
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
4+
version = "5.27.0"
105
role_name = "${var.cluster_name}-karpenter"
116
attach_karpenter_controller_policy = true
127

@@ -22,9 +17,11 @@ module "karpenter_irsa_role" {
2217
namespace_service_accounts = ["${var.k8s_service_account_namespace}:${var.k8s_service_account_name}"]
2318
}
2419
}
20+
tags = local.tags
2521
}
2622

2723
resource "aws_iam_instance_profile" "karpenter" {
2824
name = "${var.cluster_name}-karpenter-${var.controller_nodegroup_name}"
2925
role = split("/", var.controller_node_iam_role_arn)[1]
26+
tags = local.tags
3027
}

variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ variable "controller_nodegroup_name" {
2828
type = string
2929
}
3030

31-
variable "account_name" {
32-
description = "AWS Account Name"
33-
type = string
34-
}
35-
3631
variable "tags" {
3732
type = map(string)
3833
default = {}

versions.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
terraform {
2+
required_version = ">= 1.4"
3+
required_providers {
4+
aws = {
5+
source = "hashicorp/aws"
6+
version = "5.17.0"
7+
}
8+
}
9+
}

0 commit comments

Comments
 (0)