阅读时间:2分钟
如何安装Spotinst起程拓殖插件吗
在这篇文章中,我们将演示如何创建一个负载均衡器使用Spotinst起程拓殖插件。
1。terraform-provider-spotinst下载二进制文件。
请下载适当的二进制文件为您的操作系统和架构和把它在你的文件系统:
2。配置起程拓殖能够找到二进制文件:
如果你是在类unix系统上,创建一个名为.terraformrc在您的主目录的文件:
~ / .terraformrc
如果你在Windows系统上,创建一个名为起程拓殖的文件。rc % APPDATA %目录中:
% APPDATA % / terraform.rc
3所示。编辑该文件,并添加以下内容:
提供者{spotinst = " /路径/ / terraform-provider-spotinst "}
4所示。创建一个新的Multai负载均衡器。
将整个配置保存到一个文件中命名main.tf:
资源“spotinst_multai_balancer”“foo”{name = " foo " connection_timeouts{闲置= 60排水= 60}标记{env =“刺激”应用=“网络”}}资源“spotinst_multai_listener”“foo”{balancer_id = " $ {spotinst_multai_balancer.foo。协议id}”=“http”端口= 1338标记{env =“刺激”应用=“网络”}}资源”spotinst_multai_routing_rule”“foo”{balancer_id = " $ {spotinst_multai_balancer.foo。id} " listener_id = " $ {spotinst_multai_listener.foo。id} "路线= "路径(“/”)“target_set_ids = " $ {spotinst_multai_target_set.foo。{id}”,标签env =“刺激”应用=“网络”}}资源”spotinst_multai_target_set”“foo”{balancer_id = " $ {spotinst_multai_balancer.foo。id}”deployment_id = " dp - 12345 " name = " foo "协议= " http“端口= 1337体重= 1 health_check{协议= =“http”路径“/”间隔= 30超时= 10 healthy_threshold = 2 unhealthy_threshold = 2}标记{env =“刺激”应用=“网络”}}资源”spotinst_multai_target”“foo”{balancer_id = " $ {spotinst_multai_balancer.foo。id} " target_set_id = " $ {spotinst_multai_target_set.foo。id} "主机= " 172.0.0.10“端口= " 1337 "重量= 1标记{env =“刺激”应用=“网络”}}
一旦你一切设置正确,你可以执行你起程拓殖文件和应用更改。Multai应该触发一个API调用,并创建一个负载均衡器。
如果你有任何问题或评论,请到我们support@spotinst.com
最好的,
Spotinst团队。