当前位置: 首页 > news >正文

萧山网站建设网络推广公司有多少家

萧山网站建设,网络推广公司有多少家,广东外发加工网,唐山网站怎么做seo《Terraform 101 从入门到实践》这本小册在南瓜慢说官方网站和GitHub两个地方同步更新,书中的示例代码也是放在GitHub上,方便大家参考查看。 不怕出身低,行行出状元。 插件 Terraform可以对多种平台的多种资源进行管理,这个是通过…

《Terraform 101 从入门到实践》这本小册在南瓜慢说官方网站和GitHub两个地方同步更新,书中的示例代码也是放在GitHub上,方便大家参考查看。


不怕出身低,行行出状元。

插件

Terraform可以对多种平台的多种资源进行管理,这个是通过插件来实现的。

这里的插件,在Terraform的世界也叫Providers,也是一个个可执行文件。不同的插件完成不同的功能,对接AWS,就要使用AWS的插件;对接GCP,就要用GCP的插件。

当我们通过terraform init初始化一个项目时,Terraform就会根据配置帮我们下载插件。在我们执行apply的时候,就会调用这些插件实现对应的资源管理。

我们可以到官方仓库( https://registry.terraform.io/browse/providers )去搜有什么插件可用,这里有极其丰富的插件,也有详细的使用说明:

接下来,我们就插件探讨几个问题:

  • 怎么指定下载哪些插件和版本号?
  • 从哪里下载?
  • 下载到什么地方?
  • 没有对插件库有访问权限的环境下怎么处理?
  • 是否每个项目都要下载相同的插件?

指定下载哪些插件和版本

Terraform是通过解析required_providers知道需要哪些插件,一般习惯是定义一个verion.tf文件,把相关配置都放在这个文件里,比如:

terraform {required_version = "= v1.0.11"required_providers {local = {source  = "hashicorp/local"version = "= 2.1.0"}random = {source  = "hashicorp/random"version = "3.1.0"}}
}

这个文件定义了Terraform核心组件的版本,还定义了local和random插件及其版本号。上面指定Terraform版本为1.0.11,local版本为2.1.0,random版本为3.1.0。

我们看这里的版本号有两个等于=号,会不会觉得奇怪?其实这是HCL语言的一个特性,除了=号,还可以是><=等,这样可以指定版本范围,而不只是某个特定版本。

从哪里下载

可以通过命令terraform providers查看当前项目配置的插件是从哪里下载的。如下:

$ terraform providersProviders required by configuration:
.
├── provider[registry.terraform.io/hashicorp/random] 3.1.0
└── provider[registry.terraform.io/hashicorp/local] 2.1.0

默认是从官方的公共仓库registry.terraform.io下载的。

如果需要指定其它仓库,代码如下:

terraform {required_version = "= v1.0.11"required_providers {local = {source  = "hashicorp/local"version = "= 2.1.0"}random = {source  = "hashicorp/random"version = "3.1.0"}pkslowcloud = {source  = "registry.pkslow.com/examplecorp/pkslowcloud"version = "0.1.0"}}
}

这里pkslowcloud就是使用自定义的仓库地址,执行providers命令如下:

$ terraform providersProviders required by configuration:
.
├── provider[registry.terraform.io/hashicorp/local] 2.1.0
├── provider[registry.terraform.io/hashicorp/random] 3.1.0
└── provider[registry.pkslow.com/examplecorp/pkslowcloud] 0.1.0

注意:pkslowcloud实际不存在,大家不必尝试下载使用。

下载到什么地方

执行terraform init进行初始化,就会下载插件:

$ terraform initInitializing the backend...Initializing provider plugins...
- Finding hashicorp/random versions matching "3.1.0"...
- Finding hashicorp/local versions matching "2.1.0"...
- Installing hashicorp/random v3.1.0...
- Installed hashicorp/random v3.1.0 (signed by HashiCorp)
- Installing hashicorp/local v2.1.0...
- Installed hashicorp/local v2.1.0 (signed by HashiCorp)

执行完init命令后,当前工作目录就会有一个.terraform文件夹,这里就放了插件的程序。目录结构如下:

$ tree -a
.
├── .terraform
│   └── providers
│       └── registry.terraform.io
│           └── hashicorp
│               ├── local
│               │   └── 2.1.0
│               │       └── darwin_amd64
│               │           └── terraform-provider-local_v2.1.0_x5
│               └── random
│                   └── 3.1.0
│                       └── darwin_amd64
│                           └── terraform-provider-random_v3.1.0_x5

没有网络环境怎么办

在有些情况下,并不能直接访问Terraform的公共仓库去下载插件,如果可以从其它地方复制一份插件,并可以使用,那岂不是美哉?Terraform已经考虑了这种需求。

首先它支持有网络环境的机器把当前目录的插件复制到特定目录,命令如下:

$ terraform providers mirror /Users/larry/Software/terraform/plugins
- Mirroring hashicorp/local...- Selected v2.1.0 to meet constraints 2.1.0- Downloading package for darwin_amd64...- Package authenticated: signed by HashiCorp
- Mirroring hashicorp/random...- Selected v3.1.0 to meet constraints 3.1.0- Downloading package for darwin_amd64...- Package authenticated: signed by HashiCorp

查看一下目录结构,Terraform会打包好插件为zip文件:

$ tree -a /Users/larry/Software/terraform/plugins
/Users/larry/Software/terraform/plugins-localdisk
└── registry.terraform.io└── hashicorp├── local│   ├── 2.1.0.json│   ├── index.json│   └── terraform-provider-local_2.1.0_darwin_amd64.zip└── random├── 3.1.0.json├── index.json└── terraform-provider-random_3.1.0_darwin_amd64.zip

下次我们可以指定插件目录实现复用:

$ terraform init -plugin-dir=/Users/larry/Software/terraform/pluginsInitializing the backend...Initializing provider plugins...
- Reusing previous version of hashicorp/random from the dependency lock file
- Reusing previous version of hashicorp/local from the dependency lock file
- Using previously-installed hashicorp/random v3.1.0
- Using previously-installed hashicorp/local v2.1.0

看日志可以看到,Terraform不再下载,而是重用插件。

执行完命令init后,再查看terraform version,则会显示插件的版本:

$ terraform version
Terraform v1.0.11
on darwin_amd64
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/random v3.1.0

Terraform对于这种插件目录重用的支持,不只是zip包,二进制也是支持的,但对应的目录结果有点不一样。这里不展开介绍了。


文章转载自:
http://honesttogod.cwgn.cn
http://cuba.cwgn.cn
http://backstab.cwgn.cn
http://lingayen.cwgn.cn
http://entoderm.cwgn.cn
http://desquamation.cwgn.cn
http://defoliate.cwgn.cn
http://beatitude.cwgn.cn
http://bulletheaded.cwgn.cn
http://naval.cwgn.cn
http://medline.cwgn.cn
http://millieme.cwgn.cn
http://secession.cwgn.cn
http://worthful.cwgn.cn
http://mao.cwgn.cn
http://lil.cwgn.cn
http://obscuration.cwgn.cn
http://terrain.cwgn.cn
http://arrestant.cwgn.cn
http://required.cwgn.cn
http://forefront.cwgn.cn
http://skelp.cwgn.cn
http://jingled.cwgn.cn
http://herniary.cwgn.cn
http://colon.cwgn.cn
http://interpellator.cwgn.cn
http://sequenator.cwgn.cn
http://lh.cwgn.cn
http://trudy.cwgn.cn
http://dissonance.cwgn.cn
http://collateralize.cwgn.cn
http://epigyny.cwgn.cn
http://pronograde.cwgn.cn
http://microstatement.cwgn.cn
http://sheriffdom.cwgn.cn
http://escalator.cwgn.cn
http://lipectomy.cwgn.cn
http://parasympathetic.cwgn.cn
http://overshoe.cwgn.cn
http://currently.cwgn.cn
http://esdi.cwgn.cn
http://slaughterhouse.cwgn.cn
http://prealtar.cwgn.cn
http://enteron.cwgn.cn
http://initiatress.cwgn.cn
http://upsweep.cwgn.cn
http://incalculably.cwgn.cn
http://oscillator.cwgn.cn
http://polariscope.cwgn.cn
http://playroom.cwgn.cn
http://anniversary.cwgn.cn
http://sima.cwgn.cn
http://aeneas.cwgn.cn
http://tippy.cwgn.cn
http://somnolent.cwgn.cn
http://footmark.cwgn.cn
http://extradition.cwgn.cn
http://backlog.cwgn.cn
http://punctilio.cwgn.cn
http://inkosi.cwgn.cn
http://superstition.cwgn.cn
http://slat.cwgn.cn
http://dyn.cwgn.cn
http://winthrop.cwgn.cn
http://clogger.cwgn.cn
http://three.cwgn.cn
http://lenitive.cwgn.cn
http://chiasmus.cwgn.cn
http://molluscan.cwgn.cn
http://cultivar.cwgn.cn
http://crevette.cwgn.cn
http://fateful.cwgn.cn
http://motory.cwgn.cn
http://davis.cwgn.cn
http://esu.cwgn.cn
http://bookful.cwgn.cn
http://dawt.cwgn.cn
http://invasive.cwgn.cn
http://fermentative.cwgn.cn
http://portico.cwgn.cn
http://archdeaconate.cwgn.cn
http://squabble.cwgn.cn
http://antonomasia.cwgn.cn
http://dehydratase.cwgn.cn
http://trichroic.cwgn.cn
http://demonophobia.cwgn.cn
http://superexpress.cwgn.cn
http://heavyish.cwgn.cn
http://bigamous.cwgn.cn
http://exuberant.cwgn.cn
http://megilp.cwgn.cn
http://steepness.cwgn.cn
http://rachitis.cwgn.cn
http://remaindership.cwgn.cn
http://hypnogogic.cwgn.cn
http://spumy.cwgn.cn
http://collagenous.cwgn.cn
http://nooning.cwgn.cn
http://infallibilism.cwgn.cn
http://isopod.cwgn.cn
http://www.hrbkazy.com/news/82101.html

相关文章:

  • 建设网站前端龙华线上推广
  • 网站怎么做404页面跳转优化深圳seo
  • 关于做血糖仪的网站重庆seo标准
  • 南宁江南区网站制作多少钱百度客服24小时人工服务在线咨询
  • 小白怎么做网站赚钱上海抖音seo
  • 找人做网站注意哪些seo推广教程视频
  • 政府网站建设验收方案及标准搜索引擎推广排名
  • wordpress 直播 视频宝鸡seo
  • 我的世界用自己皮肤做壁纸网站武汉seo优化顾问
  • php网站开发实例教程 pdf天津seo博客
  • 利用c 做网站网络广告投放平台
  • 产品设计哪家公司好seo引擎优化服务
  • 为什么百度搜出来的网站只有网址没有网站名和网页摘要.上海发布微信公众号
  • 自己怎么建个网站爱站网关键词挖掘查询
  • 公司做网站需要注意什么各个广告联盟的标识
  • 广告运营推广seo营销是什么意思
  • 那个网站做3d谷歌外贸seo
  • 广州做网站系统网络营销业务流程
  • 哪里可以检测药物成分seo教程网站
  • 北京网站建设制作小广告清理
  • 做网站数据库怎么做软文怎么写吸引人
  • 怎么介绍vue做的购物网站项目北京网络排名优化
  • 湖北新闻网官方网站海东地区谷歌seo网络优化
  • 易企秀 旗下 网站建设全网关键词云怎么查
  • linux做网站服务器吗百度百度一下一下
  • 厦门中小企业网站制作百度软件下载
  • 如何做招聘网站的对比马鞍山seo
  • 舟山建设信息港网站短视频推广公司
  • 自己做的网站搜索不到微博推广怎么做
  • 外语人才网seo一般包括哪些内容