terraform

IaC云资源编排-Terraform

谁说我不能喝 提交于 2020-12-17 08:28:04
Terraform 2019/10/14 Chenxin 整理 转自: https://cloud.tencent.com/developer/article/1469162 IaC与资源编排 IaC(Infrastructure as Code)这一理念随着云技术的普及以及多云时代的到来而被广泛接受和认可,特别是众多生态工具产品的涌现使得IaC由概念逐渐成为现实。 1.与传统的“ClickOps”管理模式相比,IaC主要可以在以下3方面优势: 提高资源部署的速度和效率 所有的云服务都可以通过代码的方式进行部署、维护和管理,极大地提高了规模部署下的生产效率; 配置的一致性 由于所有的云服务管理都是通过代码的方式实现,因此相关的软件方法论也可以类似的迁移到IaC使用中来,能够提高开发、测试、运维环境的配置一致性,降低人为失误; 节约成本 IaC的引入可以更加高效的应对多云管理,既可以降低Opex,也可以通过多云部署方案降低资源使用成本; 2.目前,常见的IaC工具主要分为两类: 一类是配置管理类,如Chef,Puppet等,该类产品主要优势在于底层的单服务器、单服务的配置管理; 一类是资源编排类,如Terraform、Pulumi等,该类产品主要优势在于更高层面的资源编排,根据资源描述文件创建具有相互依赖关系的云资源或服务并进行配置。 值得注意的是

Documentation for AWS infrastructure as code

∥☆過路亽.° 提交于 2020-12-15 19:43:24
问题 Recently, while trying to build a terraform IaC, I found that I couldn’t get the API Gateway to route to the Lambda properly. It turned out that when using the console AWS automatically assigns the permissions the gateway needs for the Lambda, but with IaC in terraform this must be assigned explicitly. The above is understandable but for a newbie, to both AWS and terraform, confusing. Is there documentation which explains the required components within an infrastructure connection, such as

Documentation for AWS infrastructure as code

喜你入骨 提交于 2020-12-15 19:41:41
问题 Recently, while trying to build a terraform IaC, I found that I couldn’t get the API Gateway to route to the Lambda properly. It turned out that when using the console AWS automatically assigns the permissions the gateway needs for the Lambda, but with IaC in terraform this must be assigned explicitly. The above is understandable but for a newbie, to both AWS and terraform, confusing. Is there documentation which explains the required components within an infrastructure connection, such as

Documentation for AWS infrastructure as code

风流意气都作罢 提交于 2020-12-15 19:39:49
问题 Recently, while trying to build a terraform IaC, I found that I couldn’t get the API Gateway to route to the Lambda properly. It turned out that when using the console AWS automatically assigns the permissions the gateway needs for the Lambda, but with IaC in terraform this must be assigned explicitly. The above is understandable but for a newbie, to both AWS and terraform, confusing. Is there documentation which explains the required components within an infrastructure connection, such as

Terraform AlreadyExistsException: An alias with the name arn:aws:kms:XXXXX:XXXXXXXXX:alias/myalias already exists

落爺英雄遲暮 提交于 2020-12-15 07:20:11
问题 When running terraform apply I get the following error Terraform AlreadyExistsException: An alias with the name arn:aws:kms:XXXXX:XXXXXXXXX:alias/myalias already exists I can confirm that the resource (the KMS-Key-Alias) exists on AWS. How can this happen? How can I resolve this? 回答1: The problem is that the resource was created, but the Terraform state does not contain this resource. How this can happen the resource was created manually in AWS the resource was created using Terraform but the

Terraform AlreadyExistsException: An alias with the name arn:aws:kms:XXXXX:XXXXXXXXX:alias/myalias already exists

眉间皱痕 提交于 2020-12-15 07:19:08
问题 When running terraform apply I get the following error Terraform AlreadyExistsException: An alias with the name arn:aws:kms:XXXXX:XXXXXXXXX:alias/myalias already exists I can confirm that the resource (the KMS-Key-Alias) exists on AWS. How can this happen? How can I resolve this? 回答1: The problem is that the resource was created, but the Terraform state does not contain this resource. How this can happen the resource was created manually in AWS the resource was created using Terraform but the

Terraform AlreadyExistsException: An alias with the name arn:aws:kms:XXXXX:XXXXXXXXX:alias/myalias already exists

独自空忆成欢 提交于 2020-12-15 07:19:07
问题 When running terraform apply I get the following error Terraform AlreadyExistsException: An alias with the name arn:aws:kms:XXXXX:XXXXXXXXX:alias/myalias already exists I can confirm that the resource (the KMS-Key-Alias) exists on AWS. How can this happen? How can I resolve this? 回答1: The problem is that the resource was created, but the Terraform state does not contain this resource. How this can happen the resource was created manually in AWS the resource was created using Terraform but the

Terraform - Updating S3 Access Control: Question on replacing acl with grant

ⅰ亾dé卋堺 提交于 2020-12-15 06:17:48
问题 I have an S3 bucket which is used as Access logging bucket. Here is my current module and resource TF code for that: module "access_logging_bucket" { source = "../../resources/s3_bucket" environment = "${var.environment}" region = "${var.region}" acl = "log-delivery-write" encryption_key_alias = "alias/ab-data-key" name = "access-logging" name_tag = "Access logging bucket" } resource "aws_s3_bucket" "default" { bucket = "ab-${var.environment}-${var.name}-${random_id.bucket_suffix.hex}" acl =

Terraform - Updating S3 Access Control: Question on replacing acl with grant

时光怂恿深爱的人放手 提交于 2020-12-15 06:16:21
问题 I have an S3 bucket which is used as Access logging bucket. Here is my current module and resource TF code for that: module "access_logging_bucket" { source = "../../resources/s3_bucket" environment = "${var.environment}" region = "${var.region}" acl = "log-delivery-write" encryption_key_alias = "alias/ab-data-key" name = "access-logging" name_tag = "Access logging bucket" } resource "aws_s3_bucket" "default" { bucket = "ab-${var.environment}-${var.name}-${random_id.bucket_suffix.hex}" acl =

Terraform - loops

懵懂的女人 提交于 2020-12-15 06:08:02
问题 Is it possible to create a loop that creates this resources? There is a lot of repetition of the same resources. I tried using maps to create a loop but map doesn't accept anything other default block. Or is it normal to manually create all 4 resources? Just some suggestions as answer is enough, I'm trying to learn it myself. resource "aws_subnet" "public-test-a" { vpc_id = aws_vpc.vpc-test-02.id cidr_block = "10.0.0.16/28" map_public_ip_on_launch = true availability_zone = var.AZ[1] tags = {