Skip to content

Commit

Permalink
Merge pull request #36 from RADAR-base/make-prepare-fix
Browse files Browse the repository at this point in the history
Initialise plugins before running TF validate in make prepare
  • Loading branch information
baixiac authored Dec 30, 2024
2 parents 75e76ed + b7c8058 commit 6b6914d
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ prepare:
@echo Fixing the formatting
@cd cluster && terraform fmt
@echo Validating Terraform code
@cd cluster && terraform validate
@cd cluster && terraform init -backend=false && terraform validate
@echo === Config ===
@echo Generate docs
@terraform-docs markdown table config
@echo Fixing the formatting
@cd config && terraform fmt
@echo Validating Terraform code
@cd config && terraform validate
@cd config && terraform init -backend=false && terraform validate
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Created resources (if all enabled):

Make sure to install [terraform-docs](https://github.com/terraform-docs/terraform-docs) and run `make prepare` before making a commit to make sure the documentation is up to date and the code is valid.

In order to support new version of EKS you need to make sure the addons that we use are compatible with the new target version. You can get a list of addons and their EKS compatiblity with running `aws eks describe-addons-versions` and then searching for the addons that are defined in `cluster/data.tf`.
In order to support new version of EKS you need to make sure the addons that we use are compatible with the new target version. You can get a list of addons and their EKS compatiblity with running `aws eks describe-addons-versions` and then searching for the addons that are defined in [cluster/data.tf](./cluster/data.tf).

## Known limitations

Expand Down
6 changes: 6 additions & 0 deletions cluster/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 9 additions & 12 deletions cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
| [aws_vpc_endpoint.sts](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |
| [aws_vpc_security_group_ingress_rule.vpc_endpoints_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_security_group_ingress_rule) | resource |
| [kubectl_manifest.ebs_storage_classes](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubernetes_annotations.set_defaut_storage_class](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/annotations) | resource |
| [kubernetes_annotations.set_default_storage_class](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/annotations) | resource |
| [kubernetes_annotations.unset_eks_default_gp2](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/annotations) | resource |

## Inputs
Expand All @@ -56,28 +56,25 @@
| <a name="input_AWS_REGION"></a> [AWS\_REGION](#input\_AWS\_REGION) | Target AWS region | `string` | `"eu-west-2"` | no |
| <a name="input_AWS_SECRET_ACCESS_KEY"></a> [AWS\_SECRET\_ACCESS\_KEY](#input\_AWS\_SECRET\_ACCESS\_KEY) | AWS secret key associated with the access key | `string` | `""` | no |
| <a name="input_AWS_SESSION_TOKEN"></a> [AWS\_SESSION\_TOKEN](#input\_AWS\_SESSION\_TOKEN) | Session token for temporary security credentials from AWS STS | `string` | `""` | no |
| <a name="input_common_tags"></a> [common\_tags](#input\_common\_tags) | Common tags associated to resources created | `map(string)` | <pre>{<br> "Environment": "dev",<br> "Project": "radar-base"<br>}</pre> | no |
| <a name="input_common_tags"></a> [common\_tags](#input\_common\_tags) | Common tags associated to resources created | `map(string)` | <pre>{<br/> "Environment": "dev",<br/> "Project": "radar-base"<br/>}</pre> | no |
| <a name="input_create_dmz_node_group"></a> [create\_dmz\_node\_group](#input\_create\_dmz\_node\_group) | Whether or not to create a DMZ node group with taints | `bool` | `false` | no |
| <a name="input_defaut_storage_class"></a> [defaut\_storage\_class](#input\_defaut\_storage\_class) | Default storage class used for describing the EBS usage | `string` | `"radar-base-ebs-sc-gp2"` | no |
| <a name="input_dmz_node_size"></a> [dmz\_node\_size](#input\_dmz\_node\_size) | Node size of the DMZ node group | `map(number)` | <pre>{<br> "desired": 1,<br> "max": 2,<br> "min": 0<br>}</pre> | no |
| <a name="input_default_storage_class"></a> [default\_storage\_class](#input\_default\_storage\_class) | Default storage class used for describing the EBS usage | `string` | `"radar-base-ebs-sc-gp2"` | no |
| <a name="input_dmz_node_size"></a> [dmz\_node\_size](#input\_dmz\_node\_size) | Node size of the DMZ node group | `map(number)` | <pre>{<br/> "desired": 1,<br/> "max": 2,<br/> "min": 0<br/>}</pre> | no |
| <a name="input_eks_admins_group_users"></a> [eks\_admins\_group\_users](#input\_eks\_admins\_group\_users) | EKS admin IAM user group | `list(string)` | `[]` | no |
| <a name="input_eks_cluster_name"></a> [eks\_cluster\_name](#input\_eks\_cluster\_name) | EKS cluster name | `string` | n/a | yes |
| <a name="input_eks_kubernetes_version"></a> [eks\_kubernetes\_version](#input\_eks\_kubernetes\_version) | Amazon EKS Kubernetes version | `string` | `"1.31"` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | Environment name | `string` | `"dev"` | no |
| <a name="input_instance_capacity_type"></a> [instance\_capacity\_type](#input\_instance\_capacity\_type) | Capacity type used by EKS managed node groups | `string` | `"SPOT"` | no |
| <a name="input_instance_types"></a> [instance\_types](#input\_instance\_types) | List of instance types used by EKS managed node groups | `list(any)` | <pre>[<br> "m5.large",<br> "m5d.large",<br> "m5a.large",<br> "m5ad.large",<br> "m4.large"<br>]</pre> | no |
| <a name="input_worker_node_size"></a> [worker\_node\_size](#input\_worker\_node\_size) | Node size of the worker node group | `map(number)` | <pre>{<br> "desired": 2,<br> "max": 10,<br> "min": 0<br>}</pre> | no |
| <a name="input_instance_types"></a> [instance\_types](#input\_instance\_types) | List of instance types used by EKS managed node groups | `list(any)` | <pre>[<br/> "m5.large",<br/> "m5d.large",<br/> "m5a.large",<br/> "m5ad.large",<br/> "m4.large"<br/>]</pre> | no |
| <a name="input_worker_node_size"></a> [worker\_node\_size](#input\_worker\_node\_size) | Node size of the worker node group | `map(number)` | <pre>{<br/> "desired": 2,<br/> "max": 10,<br/> "min": 0<br/>}</pre> | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_radar_base_ebs_storage_class_gp2"></a> [radar\_base\_ebs\_storage\_class\_gp2](#output\_radar\_base\_ebs\_storage\_class\_gp2) | n/a |
| <a name="output_radar_base_ebs_storage_class_gp3"></a> [radar\_base\_ebs\_storage\_class\_gp3](#output\_radar\_base\_ebs\_storage\_class\_gp3) | n/a |
| <a name="output_radar_base_ebs_storage_class_io1"></a> [radar\_base\_ebs\_storage\_class\_io1](#output\_radar\_base\_ebs\_storage\_class\_io1) | n/a |
| <a name="output_radar_base_ebs_storage_class_io2"></a> [radar\_base\_ebs\_storage\_class\_io2](#output\_radar\_base\_ebs\_storage\_class\_io2) | n/a |
| <a name="output_radar_base_eks_cluser_endpoint"></a> [radar\_base\_eks\_cluser\_endpoint](#output\_radar\_base\_eks\_cluser\_endpoint) | n/a |
| <a name="output_radar_base_eks_cluser_kms_key_arn"></a> [radar\_base\_eks\_cluser\_kms\_key\_arn](#output\_radar\_base\_eks\_cluser\_kms\_key\_arn) | n/a |
| <a name="output_radar_base_default_storage_class"></a> [radar\_base\_default\_storage\_class](#output\_radar\_base\_default\_storage\_class) | n/a |
| <a name="output_radar_base_eks_cluster_endpoint"></a> [radar\_base\_eks\_cluster\_endpoint](#output\_radar\_base\_eks\_cluster\_endpoint) | n/a |
| <a name="output_radar_base_eks_cluster_kms_key_arn"></a> [radar\_base\_eks\_cluster\_kms\_key\_arn](#output\_radar\_base\_eks\_cluster\_kms\_key\_arn) | n/a |
| <a name="output_radar_base_eks_cluster_name"></a> [radar\_base\_eks\_cluster\_name](#output\_radar\_base\_eks\_cluster\_name) | n/a |
| <a name="output_radar_base_eks_dmz_node_group_name"></a> [radar\_base\_eks\_dmz\_node\_group\_name](#output\_radar\_base\_eks\_dmz\_node\_group\_name) | n/a |
| <a name="output_radar_base_eks_worker_node_group_name"></a> [radar\_base\_eks\_worker\_node\_group\_name](#output\_radar\_base\_eks\_worker\_node\_group\_name) | n/a |
Expand Down
6 changes: 3 additions & 3 deletions cluster/ebs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "kubectl_manifest" "ebs_storage_classes" {
for_each = local.storage_classes

yaml_body = <<-YAML
apiVersion: storage.k8s.io/v1
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ${each.value}
Expand Down Expand Up @@ -37,13 +37,13 @@ resource "kubernetes_annotations" "unset_eks_default_gp2" {
]
}

resource "kubernetes_annotations" "set_defaut_storage_class" {
resource "kubernetes_annotations" "set_default_storage_class" {
api_version = "storage.k8s.io/v1"
kind = "StorageClass"
force = "true"

metadata {
name = var.defaut_storage_class
name = var.default_storage_class
}
annotations = {
"storageclass.kubernetes.io/is-default-class" = "true"
Expand Down
6 changes: 3 additions & 3 deletions cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ output "radar_base_eks_cluster_name" {
value = module.eks.cluster_name
}

output "radar_base_eks_cluser_endpoint" {
output "radar_base_eks_cluster_endpoint" {
value = module.eks.cluster_endpoint
}

output "radar_base_eks_cluser_kms_key_arn" {
output "radar_base_eks_cluster_kms_key_arn" {
value = module.eks.kms_key_arn
}

Expand All @@ -23,5 +23,5 @@ output "radar_base_vpc_public_subnets" {
}

output "radar_base_default_storage_class" {
value = var.defaut_storage_class
value = var.default_storage_class
}
2 changes: 1 addition & 1 deletion cluster/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ AWS_REGION = "eu-west-2"
eks_kubernetes_version = "1.29"
environment = "dev"
eks_admins_group_users = []
defaut_storage_class = "radar-base-ebs-sc-gp2"
default_storage_class = "radar-base-ebs-sc-gp2"
create_dmz_node_group = false
4 changes: 2 additions & 2 deletions cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ variable "dmz_node_size" {
}
}

variable "defaut_storage_class" {
variable "default_storage_class" {
type = string
description = "Default storage class used for describing the EBS usage"
default = "radar-base-ebs-sc-gp2"

validation {
condition = var.defaut_storage_class == "radar-base-ebs-sc-gp2" || var.defaut_storage_class == "radar-base-ebs-sc-gp3" || var.defaut_storage_class == "radar-base-ebs-sc-io1" || var.defaut_storage_class == "radar-base-ebs-sc-io2"
condition = var.default_storage_class == "radar-base-ebs-sc-gp2" || var.default_storage_class == "radar-base-ebs-sc-gp3" || var.default_storage_class == "radar-base-ebs-sc-io1" || var.default_storage_class == "radar-base-ebs-sc-io2"
error_message = "Invalid storage class. Allowed values are 'radar-base-ebs-sc-gp2', 'radar-base-ebs-sc-gp3', 'radar-base-ebs-sc-io1' or 'radar-base-ebs-sc-io2'."
}
}
4 changes: 4 additions & 0 deletions config/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
| <a name="input_AWS_REGION"></a> [AWS\_REGION](#input\_AWS\_REGION) | Target AWS region | `string` | `"eu-west-2"` | no |
| <a name="input_AWS_SECRET_ACCESS_KEY"></a> [AWS\_SECRET\_ACCESS\_KEY](#input\_AWS\_SECRET\_ACCESS\_KEY) | AWS secret key associated with the access key | `string` | n/a | yes |
| <a name="input_AWS_SESSION_TOKEN"></a> [AWS\_SESSION\_TOKEN](#input\_AWS\_SESSION\_TOKEN) | Session token for temporary security credentials from AWS STS | `string` | `""` | no |
| <a name="input_common_tags"></a> [common\_tags](#input\_common\_tags) | Common tags associated to resources created | `map(string)` | <pre>{<br> "Environment": "dev",<br> "Project": "radar-base"<br>}</pre> | no |
| <a name="input_common_tags"></a> [common\_tags](#input\_common\_tags) | Common tags associated to resources created | `map(string)` | <pre>{<br/> "Environment": "dev",<br/> "Project": "radar-base"<br/>}</pre> | no |
| <a name="input_domain_name"></a> [domain\_name](#input\_domain\_name) | Pair of top level domain and hosted zone ID for deployed applications | `map(string)` | `{}` | no |
| <a name="input_eks_cluster_name"></a> [eks\_cluster\_name](#input\_eks\_cluster\_name) | EKS cluster name | `string` | n/a | yes |
| <a name="input_enable_eip"></a> [enable\_eip](#input\_enable\_eip) | Do you need EIP? [true, false] | `bool` | n/a | yes |
Expand Down

0 comments on commit 6b6914d

Please sign in to comment.