terraform中国能用吗 (terraform provider)

  • record successfully
  • ➜ create-buckets export|grep terraform
  • 全局生效配置文件路径
  • cat /Users/lex/.terraform.d/.terraformrc
  • hosts
  • tree for terraform directory
  • providers
  • terraform init
  • reference
  • terraform Main commands:

record successfully

➜ create-buckets export|grep terraform

  • TFCLICONFIG_FILE=/Users/lex/.terraform.d/.terraformrc
  • 配置文件.terraformrc
  • TFPLUGINCACHE_DIR=/Users/lex/.terraform.d/terraform-plugin-cache
  • 创建缓存目录

全局生效配置文件路径

  • 全局生效配置文件路径 export TF_CLI_CONFIG_FILE=$HOME/.terraform.d/.terraformrc export TF_PLUGIN_CACHE_DIR="$HOME/.terraform.d/terraform-plugin-cache"

cat /Users/lex/.terraform.d/.terraformrc

plugin_cache_dir  = "$HOME/.terraform.d/terraform-plugin-cache"
disable_checkpoint = true

hosts

  • ping 151.101.86.49 registry.terraform.io

tree for terraform directory

➜  .terraform.d pwd
/Users/lex/.terraform.d
➜  .terraform.d tree
.
├── checkpoint_cache
├── checkpoint_signature
└── terraform-plugin-cache
    └── registry.terraform.io
        └── hashicorp
            └── google
                └── 4.45.0
                    ├── darwin_amd64
                    │   └── terraform-provider-google_v4.45.0_x5
                    ├── terraform-provider-google
                    │   └── darwin_amd64 [no using]
                    └── terraform-provider-google_4.45.0_darwin_amd64.zip

7 directories, 5 files

➜  terraform-provider-google tree
.
└── darwin_amd64

0 directories, 1 file
➜  terraform-provider-google file darwin_amd64
darwin_amd64: Mach-O 64-bit executable x86_64

providers

terraform-provider-google darwin_amd64
-- Hashicorp服务器*载下**插件 手动*载下**
- https://releases.hashicorp.com/terraform-provider-google/3.35.0/
- https://releases.hashicorp.com/terraform-provider-google/4.45.0/terraform-provider-google_4.45.0_darwin_amd64.zip

➜  terraform-provider-google pwd
/Users/lex/.terraform.d/terraform-plugin-cache/registry.terraform.io/hashicorp/google/4.45.0/terraform-provider-google
➜  terraform-provider-google tree
.
└── darwin_amd64

0 directories, 1 file

terraform init

➜  create-buckets terraform init
Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hashicorp/google...
- Installing hashicorp/google v4.45.0...
- Installed hashicorp/google v4.45.0 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

reference

  • golang.org被屏蔽了,直接访问不了,解决办法如下:在 http://ping.eu/ping/ 上ping一下golang.org
  • https://cloud.tencent.com/developer/ask/sof/1470987/answer/2013800
  • https://stackoverflow.com/questions/66281882/how-can-i-get-terraform-init-to-run-on-my-apple-silicon-macbook-pro-for-the-go
  • https://www.elephdev.com/Terraform/414.html

terraform Main commands:

  • [ ] init Prepare your working directory for other commands
  • [ ] validate Check whether the configuration is valid
  • [ ] plan Show changes required by the current configuration//terraform plan -var-file=env_vars/dev.hk.tfvars
  • [ ] apply Create or update infrastructure
  • [ ] destroy Destroy previously-created infrastructure