Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 2.29 KB

说明.md

File metadata and controls

54 lines (36 loc) · 2.29 KB

就腾讯云加社区文章的细节说明

1.文中的第一步,大家可以看到一些腾讯云api的密码,这个密码是在腾讯云console里边创建,相应的链接在这里

2.基于安全的原因,不建议把腾讯云API Key写到源代码里

一般建议把这类信息放在环境变量里边。比如:

$ export TENCENTCLOUD_SECRET_ID="your_fancy_accesskey"
$ export TENCENTCLOUD_SECRET_KEY="your_fancy_secretkey"
$ export TENCENTCLOUD_REGION="ap-guangzhou"

这样的话provider部分就可以是全空的了, 比如:

provider "tencentcloud" {}

具体可以参考这里

3. 在第2步plan之前,需要对terraform进行初始化,terraform会根据代码下载相应的provider。例如:

first-example git:(master) ✗ terraform init

Initializing the backend...

Initializing provider plugins...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.tencentcloud: version = "~> 1.12"

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.

4. 第2大步第4小步创建CVM的地方,使用的镜像需要自行创建,也可以使用公共镜像。镜像id可以在腾讯云控制台里边查到。

5. 为了方便各位小伙伴学习,我利用文章里的例子,编写了一段使用资源比较小的例子,采用了公共镜像,如果需要的话,可以在这里找到。