😊杨鼎睿的笔记

Search

Search IconIcon to open search

Last updated | Edit Source

# 1. 创建配置文件

.terraformrcTerraform CLI的配置文件

1
2
3
4
5
6
7
8
plugin_cache_dir  = "/root/.terraform.d/terraform-plugin-cache" 
disable_checkpoint = true
provider_installation {
  filesystem_mirror {
    path    = "/root/.terraform.d/terraform-plugin-cache"
    include = ["registry.terraform.io/*/*"]
  }
}

# 2. 进行初始化

插件下载方式有两种:

  1. 通过 terraform init 自动下载 provider 插件;
  2. 登入registry.terraform.io手动到 GitHub下载,并按照目录结构存放到plugin_cache_dir;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
❯ tree /root/.terraform.d
/root/.terraform.d
├── checkpoint_signature
└── terraform-plugin-cache
    └── registry.terraform.io
        ├── coder
        │   └── coder
        │       └── 0.5.0
        │           └── linux_amd64
        │               └── terraform-provider-coder_v0.5.0
        └── kreuzwerker
            └── docker
                └── 2.20.2
                    └── linux_amd64
                        └── terraform-provider-docker_v2.20.2

然后运行 terraform init 即可