diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 7d005a3f8..4f23e2172 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -3,43 +3,57 @@ name: Pull Request on: pull_request: branches: - - main + - main permissions: contents: read - + jobs: build-website: - name: 'Build website' + name: "Build website" runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: 18 - - name: Get kubectl version - run: | - source hack/lib/kubectl-version.sh - echo "Using kubectl ${KUBECTL_VERSION}" - echo "KUBECTL_VERSION=$KUBECTL_VERSION" >> $GITHUB_ENV - - uses: azure/setup-kubectl@v3 - with: - version: '${{ env.KUBECTL_VERSION }}' - id: install - - name: Run website build - working-directory: website - run: | - npm install - npm run build + - name: Check out code + uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Get kubectl version + run: | + source hack/lib/kubectl-version.sh + echo "Using kubectl ${KUBECTL_VERSION}" + echo "KUBECTL_VERSION=$KUBECTL_VERSION" >> $GITHUB_ENV + - uses: azure/setup-kubectl@v3 + with: + version: "${{ env.KUBECTL_VERSION }}" + id: install + - name: Run website build + working-directory: website + run: | + npm install + npm run build build-lab: - name: 'Build lab' + name: "Build lab" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Make shell + run: | + make shell shell_simple_command='ls' + + pre-commit: + name: "Pre-commit hooks" runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Make shell - run: | - make shell shell_simple_command='ls' + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: Setup TFLint + uses: terraform-linters/setup-tflint@v4 + - name: Setup terraform-docs + uses: jaxxstorm/action-install-gh-release@v1.10.0 + with: + repo: terraform-docs/terraform-docs + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 54266fb80..939ded7b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,29 +1,21 @@ -repos: [] - #- repo: https://github.com/antonbabenko/pre-commit-terraform - # rev: v1.77.0 - # hooks: - # - id: terraform_fmt - # # - id: terraform_validate - # - id: terraform_docs - # args: - # - '--args=--lockfile=false' - # - id: terraform_tflint - # args: - # - '--args=--only=terraform_deprecated_interpolation' - # - '--args=--only=terraform_deprecated_index' - # - '--args=--only=terraform_unused_declarations' - # - '--args=--only=terraform_comment_syntax' - # - '--args=--only=terraform_documented_outputs' - # - '--args=--only=terraform_documented_variables' - # - '--args=--only=terraform_typed_variables' - # - '--args=--only=terraform_module_pinned_source' - # - '--args=--only=terraform_naming_convention' - # - '--args=--only=terraform_required_version' - # - '--args=--only=terraform_required_providers' - # # - '--args=--only=terraform_standard_module_structure' - # - '--args=--only=terraform_workspace_remote' - #- repo: https://github.com/pre-commit/pre-commit-hooks - # rev: v4.4.0 - # hooks: - # - id: check-merge-conflict - # - id: end-of-file-fixer +repos: + - repo: https://github.com/antonbabenko/pre-commit-terraform + rev: v1.77.0 + hooks: + - id: terraform_fmt + #- id: terraform_validate + - id: terraform_docs + args: + - "--args=--lockfile=false" + - id: terraform_tflint + args: + - "--args=--only=terraform_deprecated_interpolation" + - "--args=--only=terraform_deprecated_index" + - "--args=--only=terraform_unused_declarations" + - "--args=--only=terraform_comment_syntax" + - "--args=--only=terraform_documented_outputs" + - "--args=--only=terraform_documented_variables" + - "--args=--only=terraform_typed_variables" + - "--args=--only=terraform_module_pinned_source" + - "--args=--only=terraform_naming_convention" + - "--args=--only=terraform_workspace_remote" diff --git a/cluster/terraform/eks.tf b/cluster/terraform/eks.tf index 2f0f2155d..b8570c15e 100644 --- a/cluster/terraform/eks.tf +++ b/cluster/terraform/eks.tf @@ -39,7 +39,7 @@ module "eks" { min_size = 3 max_size = 6 desired_size = 3 - + update_config = { max_unavailable_percentage = 50 } diff --git a/cluster/terraform/variables.tf b/cluster/terraform/variables.tf index faefa9f12..6f2f348cb 100644 --- a/cluster/terraform/variables.tf +++ b/cluster/terraform/variables.tf @@ -1,6 +1,7 @@ variable "cluster_name" { - type = string - default = "eks-workshop" + description = "Name of the EKS cluster" + type = string + default = "eks-workshop" } variable "cluster_version" { diff --git a/manifests/.workshop/terraform/base.tf b/manifests/.workshop/terraform/base.tf index 287085492..5f8a0da92 100644 --- a/manifests/.workshop/terraform/base.tf +++ b/manifests/.workshop/terraform/base.tf @@ -28,13 +28,17 @@ terraform { } } +# tflint-ignore: terraform_unused_declarations variable "eks_cluster_id" { - type = string + description = "EKS cluster name" + type = string } +# tflint-ignore: terraform_unused_declarations variable "resources_precreated" { - type = bool - default = false + description = "Have expensive resources been created already" + type = bool + default = false } data "aws_partition" "current" {} diff --git a/manifests/.workshop/terraform/lab/vars.tf b/manifests/.workshop/terraform/lab/vars.tf index 569c47683..812087dc5 100644 --- a/manifests/.workshop/terraform/lab/vars.tf +++ b/manifests/.workshop/terraform/lab/vars.tf @@ -1,23 +1,35 @@ +# tflint-ignore: terraform_unused_declarations variable "eks_cluster_id" { - type = string + description = "EKS cluster name" + type = string } +# tflint-ignore: terraform_unused_declarations variable "eks_cluster_version" { - type = string + description = "EKS cluster version" + type = string } +# tflint-ignore: terraform_unused_declarations variable "cluster_security_group_id" { - type = any + description = "EKS cluster security group ID" + type = any } +# tflint-ignore: terraform_unused_declarations variable "addon_context" { - type = any + description = "Addon context that can be passed directly to blueprints addon modules" + type = any } +# tflint-ignore: terraform_unused_declarations variable "tags" { - type = any + description = "Tags to apply to AWS resources" + type = any } +# tflint-ignore: terraform_unused_declarations variable "resources_precreated" { - type = bool + description = "Have expensive resources been created already" + type = bool } diff --git a/manifests/.workshop/terraform/outputs.tf b/manifests/.workshop/terraform/outputs.tf index 9aa261bd9..b2734f3c4 100644 --- a/manifests/.workshop/terraform/outputs.tf +++ b/manifests/.workshop/terraform/outputs.tf @@ -1,3 +1,4 @@ output "environment" { - value = try(module.lab.environment, "") + description = "Evaluated by the IDE shell" + value = try(module.lab.environment, "") } diff --git a/manifests/modules/aiml/inferentia/.workshop/terraform/main.tf b/manifests/modules/aiml/inferentia/.workshop/terraform/main.tf index ed3d2d874..f9d8465af 100644 --- a/manifests/modules/aiml/inferentia/.workshop/terraform/main.tf +++ b/manifests/modules/aiml/inferentia/.workshop/terraform/main.tf @@ -118,7 +118,8 @@ resource "kubectl_manifest" "neuron_device_plugin" { } output "environment" { - value = <