charmkeeper-terraform

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Plan:
  • Find the terraform modules in the repository.
  • Ensure each terraform module is following the implementation standards.
  • Run the tests to ensure the modules work as expected.
计划:
  • 在代码仓库中找到Terraform模块。
  • 确保每个Terraform模块都符合实施标准。
  • 运行测试以确保模块按预期工作。

Implementation standards

实施标准

  • Expected versions:
    • terraform
      : ~> 1.12
    • juju provider
      : ~> 1.0
  • The module should only have a "model_uuid" variable, no "model" variable.
  • Lint terraform modules with
    terraform fmt --recursive
    and
    tflint --recursive
    (fix the errors and the warnings).
  • 预期版本:
    • terraform
      : ~> 1.12
    • juju provider
      : ~> 1.0
  • 模块应仅包含"model_uuid"变量,不得有"model"变量。
  • 使用
    terraform fmt --recursive
    tflint --recursive
    对Terraform模块进行代码检查(修复所有错误和警告)。

Testing

测试

Writing terraform tests

编写Terraform测试

Local testing

本地测试

The terraform tests should be run in a virtual machine named "charmkeeper".
If the machine doesn't exist, create it with:
scripts/create-charmkeeper-vm.sh
.
If not already done, mount the working directory folder in the machine with
bash
multipass mount --type native $PWD charmkeeper:/workdir
For each TERRAFORM_MODULE
bash
multipass exec charmkeeper -d /workdir/$TERRAFORM_MODULE -- terraform init
multipass exec charmkeeper -d /workdir/$TERRAFORM_MODULE -- terraform test
Terraform测试应在名为"charmkeeper"的虚拟机中运行。
如果该虚拟机不存在,可通过以下命令创建:
scripts/create-charmkeeper-vm.sh
如果尚未挂载工作目录,可通过以下命令将其挂载到虚拟机中:
bash
multipass mount --type native $PWD charmkeeper:/workdir
对于每个TERRAFORM_MODULE:
bash
multipass exec charmkeeper -d /workdir/$TERRAFORM_MODULE -- terraform init
multipass exec charmkeeper -d /workdir/$TERRAFORM_MODULE -- terraform test

CI testing

CI测试

  • Adapt the k8s-controller and lxd-controller value depending on the charm type.
  • Adapt the
    terraform-directories
    to reflect where the modules are in this charm.
  • 根据Charm类型调整k8s-controller和lxd-controller的值。
  • 调整
    terraform-directories
    以反映当前Charm中模块的位置。

Maintain

维护

Configuring renovate

配置Renovate

  • Add a charmhub datasource and use it.
  • Add a regex custom manager for revisions.
  • Set ignorePath to an empty array to not exclude the tests/ folders of terraform.
  • 添加并使用charmhub数据源。
  • 为版本号添加正则自定义管理器。
  • 将ignorePath设置为空数组,不排除Terraform的tests/文件夹。