diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 90b9185..f29e41a 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -1,5 +1,5 @@ name: "Terraform test" -on: [push, pull_request] +on: [pull_request] jobs: tflint: @@ -8,7 +8,7 @@ jobs: steps: - uses: actions/checkout@master - name: TFLint - uses: docker://wata727/tflint + uses: docker://ghcr.io/terraform-linters/tflint:v0.48.0 fmt-and-validate: name: fmt and validate @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@master - name: Install terraform env: - TF_VERSION: 1.2.8 + TF_VERSION: 1.5.7 run: | # Install terraform wget https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_amd64.zip -O /tmp/terraform.zip diff --git a/modules/containerd/files/config.toml b/modules/containerd/files/config.toml index 29bbafb..f8659c6 100644 --- a/modules/containerd/files/config.toml +++ b/modules/containerd/files/config.toml @@ -1,3 +1,5 @@ version = 2 +[debug] + level = "${log_level}" [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] SystemdCgroup = true \ No newline at end of file diff --git a/modules/containerd/main.tf b/modules/containerd/main.tf index b91cc08..dc317bc 100644 --- a/modules/containerd/main.tf +++ b/modules/containerd/main.tf @@ -12,9 +12,10 @@ data "ignition_file" "containerd_config" { overwrite = true content { - content = file("${path.module}/files/config.toml") + content = templatefile("${path.module}/files/config.toml", { + log_level = var.log_level + }) } - } data "ignition_file" "crictl_config" { diff --git a/modules/containerd/variables.tf b/modules/containerd/variables.tf index e69de29..2a06284 100644 --- a/modules/containerd/variables.tf +++ b/modules/containerd/variables.tf @@ -0,0 +1,5 @@ +variable "log_level" { + description = "(Optional) containerd log level (trace, debug, info, warn, error, fatal, panic), default is info" + type = string + default = "info" +} diff --git a/modules/containerd/version.tf b/modules/containerd/version.tf index d5a524c..00b2093 100644 --- a/modules/containerd/version.tf +++ b/modules/containerd/version.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.2.0" + required_version = ">= 1.5.0" required_providers { ignition = { diff --git a/modules/docker/main.tf b/modules/docker/main.tf index 86cc0b4..e128061 100644 --- a/modules/docker/main.tf +++ b/modules/docker/main.tf @@ -1,4 +1,5 @@ locals { + docker_opts = concat(var.docker_opts, ["--log-level", var.log_level]) docker_cgroup = concat(var.docker_cgroups, var.docker_cgroup_driver == "systemd" ? ["--exec-opt native.cgroupdriver=systemd"] : [""]) } @@ -9,7 +10,7 @@ data "ignition_systemd_unit" "docker_dropin" { dropin { name = "10-dockeropts.conf" content = templatefile("${path.module}/templates/10-dockeropts.conf.tpl", { - docker_opts = join(" ", var.docker_opts) + docker_opts = join(" ", local.docker_opts) docker_cgroups = join(" ", local.docker_cgroup) }) } diff --git a/modules/docker/variables.tf b/modules/docker/variables.tf index 400e7b2..1c4b3e0 100644 --- a/modules/docker/variables.tf +++ b/modules/docker/variables.tf @@ -20,4 +20,10 @@ variable "docker_cgroups" { variable "docker_cgroup_driver" { type = string default = "cgroupfs" +} + +variable "log_level" { + description = "(Optional) Docker daemon log level (debug, info, warn, error, fatal), default is info" + type = string + default = "info" } \ No newline at end of file diff --git a/modules/docker/version.tf b/modules/docker/version.tf index d5a524c..00b2093 100644 --- a/modules/docker/version.tf +++ b/modules/docker/version.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.2.0" + required_version = ">= 1.5.0" required_providers { ignition = { diff --git a/modules/ecr-helper/version.tf b/modules/ecr-helper/version.tf index d5a524c..00b2093 100644 --- a/modules/ecr-helper/version.tf +++ b/modules/ecr-helper/version.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.2.0" + required_version = ">= 1.5.0" required_providers { ignition = { diff --git a/modules/legacy-cgroups/version.tf b/modules/legacy-cgroups/version.tf index d5a524c..00b2093 100644 --- a/modules/legacy-cgroups/version.tf +++ b/modules/legacy-cgroups/version.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.2.0" + required_version = ">= 1.5.0" required_providers { ignition = { diff --git a/modules/locksmithd/version.tf b/modules/locksmithd/version.tf index d5a524c..00b2093 100644 --- a/modules/locksmithd/version.tf +++ b/modules/locksmithd/version.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.2.0" + required_version = ">= 1.5.0" required_providers { ignition = { diff --git a/modules/node-exporter/version.tf b/modules/node-exporter/version.tf index d5a524c..00b2093 100644 --- a/modules/node-exporter/version.tf +++ b/modules/node-exporter/version.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.2.0" + required_version = ">= 1.5.0" required_providers { ignition = { diff --git a/modules/ntp/version.tf b/modules/ntp/version.tf index d5a524c..00b2093 100644 --- a/modules/ntp/version.tf +++ b/modules/ntp/version.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.2.0" + required_version = ">= 1.5.0" required_providers { ignition = { diff --git a/modules/sshd/version.tf b/modules/sshd/version.tf index d5a524c..00b2093 100644 --- a/modules/sshd/version.tf +++ b/modules/sshd/version.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.2.0" + required_version = ">= 1.5.0" required_providers { ignition = { diff --git a/modules/systemd-networkd/main.tf b/modules/systemd-networkd/main.tf index 863c9e4..7076742 100644 --- a/modules/systemd-networkd/main.tf +++ b/modules/systemd-networkd/main.tf @@ -1,10 +1,6 @@ # the systemd-networkd configuration file 10-eni.network and 10-eth.network need to be adjusted after systemd updated # Reference: https://github.com/aws/amazon-vpc-cni-k8s/issues/1600 -locals { - systemd_log_level = var.debug ? "debug" : "warning" -} - data "ignition_file" "systemd_networkd_log_level" { mode = 420 @@ -13,7 +9,7 @@ data "ignition_file" "systemd_networkd_log_level" { content { content = templatefile("${path.module}/templates/10-log-level.conf.tpl", { - log_level = local.systemd_log_level + log_level = var.log_level }) } } diff --git a/modules/systemd-networkd/variables.tf b/modules/systemd-networkd/variables.tf index 46de043..0971e3c 100644 --- a/modules/systemd-networkd/variables.tf +++ b/modules/systemd-networkd/variables.tf @@ -1,7 +1,7 @@ -variable "debug" { - description = "(Optional) Enable CoreOS Systemd Networkd debug log or not" - type = bool - default = false +variable "log_level" { + description = "(Optional) The systemd-networkd log level, default is warning" + type = string + default = "warning" } variable "manage_foreign_policy" { diff --git a/modules/systemd-networkd/version.tf b/modules/systemd-networkd/version.tf index d5a524c..00b2093 100644 --- a/modules/systemd-networkd/version.tf +++ b/modules/systemd-networkd/version.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.2.0" + required_version = ">= 1.5.0" required_providers { ignition = { diff --git a/modules/update-ca-certificates/version.tf b/modules/update-ca-certificates/version.tf index d5a524c..00b2093 100644 --- a/modules/update-ca-certificates/version.tf +++ b/modules/update-ca-certificates/version.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.2.0" + required_version = ">= 1.5.0" required_providers { ignition = { diff --git a/tests/main.tf b/tests/main.tf index 55c345e..85d69f1 100644 --- a/tests/main.tf +++ b/tests/main.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.2.0" + required_version = ">= 1.5.0" required_providers { ignition = {