terraform

How to get the most recent shared AWS RDS snapshot by id?

江枫思渺然 提交于 2020-03-02 09:44:28
问题 I have 2 databases on AWS RDS, one for stage and one for production across 2 accounts. I am trying to copy the data in production to stage every x days. My plan was to make a copy of the most recent automatic backup snapshot in production and share it to the stage account before creating the database in stage using the shared snapshot from production . Everything was going right until I ran into what I believe is a bug but it could easily be that I made a mistake. When I tried to get the most

云服务OpenAPI的7大挑战,架构师如何应对?

痞子三分冷 提交于 2020-02-29 07:25:16
阿里妹导读:API 是模块或者子系统之间交互的接口定义。好的系统架构离不开好的 API 设计,而一个设计不够完善的 API 则注定会导致系统的后续发展和维护非常困难。比较好的API设计样板可以参考 github 和 k8s ,它们都是典型的RESTful接口。云服务对外开放的窗口就是OpenAPI,今天要讨论的话题是“云服务场景下OpenAPI设计的挑战”。 为什么要有API规范 之所以强调“云服务”的原因在于,小规模独立API的设计与大规模批量生产API面临的问题是不一样的。同样,只专注于自身产品API的可用性与从更高的层次去看云服务整体API体系的健壮性,要建设的体系也是不一样的。 例如,做一个WEB页面使用的API,只需要考虑性能、稳定性、鉴权就好,因为页面与API是一体的,可以一起发布和回滚,只要功能正常,即便API设计有缺陷,用户也可以接受。而云服务要开放API考虑问题就多了: 首先,云服务开放的是基础设施和服务接口,一般是系统级的对接,API一旦开放想要变更就非常困难; 其次,云服务并非单独运行,不同的产品实际场景中是互相组合的,需考虑产品间的一致性和互通便利性; 云服务API数量庞大,为了更方便使用,配套的API查找、编排、自动化生成SDK等需求也比普通服务强烈; 云服务的稳定性非常重要,核心产品的稳定性就是客户的生命线,要求非常高。 所以云服务由于产品线众多

Terraform on Azure - Deploy multiple subnet

与世无争的帅哥 提交于 2020-02-25 13:17:58
问题 I'm trying to implement a Terraform script to create multiple subnets. resource "azurerm_subnet" "test_subnet" { name = "testSUBNET" resource_group_name = "${local.resource_group_name}" virtual_network_name = "${azurerm_virtual_network.lab_vnet.name}" address_prefix = "10.0.1.0/24" } Is there a way to do a for-each or a loop on a variable in order to create them at the same time? Best Regards! 回答1: You can achieve this using a variable and count index as follows: variable "subnet_prefix" {

Terraform on Azure - Deploy multiple subnet

混江龙づ霸主 提交于 2020-02-25 13:17:09
问题 I'm trying to implement a Terraform script to create multiple subnets. resource "azurerm_subnet" "test_subnet" { name = "testSUBNET" resource_group_name = "${local.resource_group_name}" virtual_network_name = "${azurerm_virtual_network.lab_vnet.name}" address_prefix = "10.0.1.0/24" } Is there a way to do a for-each or a loop on a variable in order to create them at the same time? Best Regards! 回答1: You can achieve this using a variable and count index as follows: variable "subnet_prefix" {

Terraform how to get IP address of aws_lb

。_饼干妹妹 提交于 2020-02-24 05:27:40
问题 Question If there a way to get the assigned IP address of an aws_lb resource at the time aws_lb is created by Terraform? As in AWS documentation - NLB - To find the private IP addresses to whitelist, we can find out the IP address associated to ELB. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/. In the navigation pane, choose Network Interfaces. In the search field, type the name of your Network Load Balancer. There is one network interface per load balancer subnet. On

Terraform how to get IP address of aws_lb

不想你离开。 提交于 2020-02-24 05:26:31
问题 Question If there a way to get the assigned IP address of an aws_lb resource at the time aws_lb is created by Terraform? As in AWS documentation - NLB - To find the private IP addresses to whitelist, we can find out the IP address associated to ELB. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/. In the navigation pane, choose Network Interfaces. In the search field, type the name of your Network Load Balancer. There is one network interface per load balancer subnet. On

Cannot run `source` in AWS Codebuild

爷,独闯天下 提交于 2020-02-23 09:06:16
问题 I am using AWS CodeBuild along with Terraform for automated deployment of a Lambda based service. I have a very simple buildscript.yml that accomplishes the following: Get dependencies Run Tests Get AWS credentials and save to file (detailed below) Source the creds file Run Terraform The step "source the creds file" is where I am having my difficulty. I have a simply bash one-liner that grabs the AWS container creds off of curl 169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI and then

How to use terraform output as input variable of another terraform template

非 Y 不嫁゛ 提交于 2020-02-20 07:16:11
问题 Is there any way I can use a Terraform template output to another Terraform template's input? Ex: I have a Terraform template which creates an ELB and I have another Terraform template which is going to create an auto scale group which need the ELB information as an input variable. I know I can use shell script to grep and feed in the ELB information, but I'm looking for some Terraform way to doing this. 回答1: Have you tried using remote state to populate your second template? Declare it like

How to import manual changes into Terraform remote state

送分小仙女□ 提交于 2020-02-19 04:39:49
问题 I am new to terraform - I have created remote tfstate in s3, and now there are some manual changes too that are done in my AWS infrastructure. I need to import those manual changes into tfstate. I used the import command for some resources, but for some resources such as IAM policy etc, there is no such import command. Also some resources such as DB are changed with new parameters added, and I need to import them as well. When I try to import those changes it says: Error importing: 1 error(s)

How to import manual changes into Terraform remote state

爷,独闯天下 提交于 2020-02-19 04:39:01
问题 I am new to terraform - I have created remote tfstate in s3, and now there are some manual changes too that are done in my AWS infrastructure. I need to import those manual changes into tfstate. I used the import command for some resources, but for some resources such as IAM policy etc, there is no such import command. Also some resources such as DB are changed with new parameters added, and I need to import them as well. When I try to import those changes it says: Error importing: 1 error(s)