terraform

How to map static IP to terraform google compute engine instance?

六月ゝ 毕业季﹏ 提交于 2020-08-24 21:50:21
问题 I'm using terraform with google vm provider. I want to assign existing Static IP to a VM. Code : resource "google_compute_instance" "test2" { name = "dns-proxy-nfs" machine_type = "n1-standard-1" zone = "${var.region}" disk { image = "centos-7-v20170719" } metadata { ssh-keys = "myuser:${file("~/.ssh/id_rsa.pub")}" } network_interface { network = "default" access_config { address = "130.251.4.123" } } } But its failing with the error: google_compute_instance.test2: network_interface.0.access

How to map static IP to terraform google compute engine instance?

南笙酒味 提交于 2020-08-24 21:48:19
问题 I'm using terraform with google vm provider. I want to assign existing Static IP to a VM. Code : resource "google_compute_instance" "test2" { name = "dns-proxy-nfs" machine_type = "n1-standard-1" zone = "${var.region}" disk { image = "centos-7-v20170719" } metadata { ssh-keys = "myuser:${file("~/.ssh/id_rsa.pub")}" } network_interface { network = "default" access_config { address = "130.251.4.123" } } } But its failing with the error: google_compute_instance.test2: network_interface.0.access

Terraform: correct way to attach AWS managed policies to a role?

瘦欲@ 提交于 2020-08-21 21:11:07
问题 I want to attach one of the pre-existing AWS managed roles to a policy, here's my current code: resource "aws_iam_role_policy_attachment" "sto-readonly-role-policy-attach" { role = "${aws_iam_role.sto-test-role.name}" policy_arn = "arn:aws:iam::aws:policy/ReadOnlyAccess" } Is there a better way to model the managed policy and then reference it instead of hardcoding the ARN? It just seems like whenever I hardcode ARNs / paths or other stuff like this, I usually find out later there was a

【AWS征文】Infrastructure as Code 在 AWS 上面是一种什么样的体验

半腔热情 提交于 2020-08-17 12:44:31
因为云服务的特性,创建各种服务只需要请求一个 API 即可,所以 Infrastructure as Code(IaC) 也随之兴起,可以通过一份代码即可保存我们的云资源环境与架构,想要在另外一个地区创建一套相同的资源也变得非常简单,那么在 AWS 中,我们是如何把云中资源保存在代码中的呢? 一、CloudFormation CloudFormation 是什么 AWS 早在 2011 年就推出了 AWS CloudFormation。对于 AWS 这样一个推崇去中心化小团队的公司来说,能形成 CloudFormation 这样一个基建即代码的服务是非常了不起的。 这个团队需要集成几乎所有的 AWS 服务,而且需要集成到每一个细节,到每一个 API 的每一个参数。而且在服务更新,新服务上线的时候,CloudFormation 也需要对应着进行更新。在一个去中心化的环境中,能做到这样一个高度集中的产品,还做得如此完善,很不容易。 CloudFormation 让用户可以用 YAML 或者 JSON 模板来描述自己的基建,形成一个Stack。如果要修改基建,用户可以修改自己的模板,然后上传进行对比,形成Change Set,用来确认基建栈中哪些资源会被修改。确认保存之后,基建就会调整成预想的样子。如果遇到问题,CloudFormation 会尝试直接回滚。 我想通过以上的介绍

SpringCloud 应用在 Kubernetes 上的最佳实践 — 部署篇(工具部署)

人走茶凉 提交于 2020-08-16 12:24:18
作者 | 孤弋 阿里云高级技术专家,负责 EDAS 的开发和用户体验优化工作。 导读 :上一篇文章 《SpringCloud 应用在 Kubernetes 上的最佳实践 — 部署篇(开发部署)》 我们介绍了从 IDE 插件内介绍了如何进行应用部署的方式,除此之外,目前 EDAS 还支持了额外的工具对其他场景进行覆盖,这一篇内容主要就是介绍 EDAS 上围绕部署的工具体系。 相关文章推荐: 《SpringCloud 应用在 Kubernetes 上的最佳实践 —— 开发篇》 《SpringCloud 应用在 Kubernetes 上的最佳实践 — 部署篇(开发部署)》 IDE 插件中进行部署 因为 IDE 是离开发人员的代码最近的工具,所以 IDE 插件中的部署能力也是专门为开发人员提供的部署工具,他的特点就是速度快、使用简单,同时也覆盖了 ECS 集群与 Kubernetes 集群中的 War/Jar 、以及自定义镜像的部署方式。具体使用方式,我们都已经整理成了官方文档,请在 EDAS 的官方帮助文档中,查看《使用 Cloud Toolkit 快速部署应用至 EDAS》章节。 不过对于线上的应用而言,如果随便一个开发人员都能进行随意的变更,这是一件很不安全的事情。EDAS 在命名空间设计的时候,也考虑到了这个问题,解决的办法就是 EDAS 上的命名空间

Polkadot-k8s实战教程

南楼画角 提交于 2020-08-15 14:10:27
polkadot-k8s是一个用于快速搭建安全的Polkadot或Kusama验证节点的开源项目。Polkadot是一个支持分片的采用POS共识的区块链,Kusma是Polkadot的测试网络。在这个教程中,我们将学习如何利用自动化工具在Google Kubernetes Engine上部署Polkadot验证节点,不需要编译任何Rust代码或安全任何启动脚本。 区块链开发教程链接: 以太坊 | 比特币 | EOS | Tendermint | Hyperledger Fabric | Omni/USDT | Ripple 1、Polkadot K8s安装准备 在开始之前建议你先了解下Polkadot中的 抵押概念 并通读 如何成为验证节点 。 然后创建一个 Google Cloud 账号,你可以得到价值$300的免费积分,这足够跑通本教程了。 接下来下载以下应用并安装在你的机器上。 Google Cloud SDK Kubectl Terraform 执行身份验证并创建本地的应用凭证: gcloud auth login gcloud auth application-default login 2、polkadot k8s安装部署 克隆 polkadot-k8s 仓库并执行以下命令: cd terrraform terraform init terraform plan

Use variable in Terraform remote backend

眉间皱痕 提交于 2020-08-15 12:09:26
问题 # Using a single workspace: terraform { backend "remote" { hostname = "app.terraform.io" organization = "company" workspaces { name = "my-app-prod" } } } For Terraform remote backend, would there be a way to use variable to specify the organization / workspace name instead of the hardcoded values there? The Terraform documentation didn't seem to mention anything related either. 回答1: The backend configuration documentation goes into this in some detail. The main point to note is this: Only one

Use variable in Terraform remote backend

[亡魂溺海] 提交于 2020-08-15 12:07:14
问题 # Using a single workspace: terraform { backend "remote" { hostname = "app.terraform.io" organization = "company" workspaces { name = "my-app-prod" } } } For Terraform remote backend, would there be a way to use variable to specify the organization / workspace name instead of the hardcoded values there? The Terraform documentation didn't seem to mention anything related either. 回答1: The backend configuration documentation goes into this in some detail. The main point to note is this: Only one

Use variable in Terraform remote backend

瘦欲@ 提交于 2020-08-15 12:07:12
问题 # Using a single workspace: terraform { backend "remote" { hostname = "app.terraform.io" organization = "company" workspaces { name = "my-app-prod" } } } For Terraform remote backend, would there be a way to use variable to specify the organization / workspace name instead of the hardcoded values there? The Terraform documentation didn't seem to mention anything related either. 回答1: The backend configuration documentation goes into this in some detail. The main point to note is this: Only one

重磅消息!!!Terraform、Consul、Vagrant等禁止中国使用!

雨燕双飞 提交于 2020-08-14 19:07:20
#程序员薪资揭榜#你做程序员几年了?月薪多少?发量还在么?>>> 国外HashiCorp在官网宣布:不允许中国境内使用、部署和安装该企业旗下的产品和软件。 消息来源hashicorp官网: https://www.hashicorp.com/terms-of-evaluation Terraform :Terraform 是一种安全有效地构建、更改和版本控制基础设施的开源工具(基础架构自动化的编排工具)。它的目标是 "Write, Plan, and create Infrastructure as Code", 基础架构即代码,Terraform也提供了Kubernetes应用程序的完整生命周期管理,包含Pod的创建、删除以及副本控制等。国内众多公有云都支持Terraform。 Consul :是一个支持多数据中心分布式高可用的服务发现和配置共享的服务软件,由 HashiCorp 公司用 Go 语言开发,目前在国内也有大量的使用和落地案例。 Vagrant :也是一个比较流行的虚拟机管理软件,使用Vagrant 可以让我们用命令直接从云上下载虚拟机的镜像,然后进行创建和管理等。 国产加油! 中国加油! 来源: oschina 链接: https://my.oschina.net/u/4364212/blog/4297773