在 AWS 控制台中,用户可以创建一个 API Gateway 授权者,其值为“自动授予 API Gateway”的 true/false 值。
但是,我没有看到 Terraform 中的 AWS 提供商为aws_apigatewayv2_authorizer资源公开此标志。
有没有办法通过 Terraform 设置这个?
amazon-web-services terraform aws-api-gateway terraform-provider-aws
我正在尝试使用 Terraform 创建新的 AWS Cognito 用户池,目前遇到以下问题:
我一直在尝试获取电子邮件地址或电话号码->允许选择电子邮件地址(如下以红色显示),而不是当前选择的地址(用户名->还允许使用经过验证的电子邮件地址登录)
我的文件的相关部分main.tf如下所示:
resource "aws_cognito_user_pool" "app_cognito_user_pool" {
name = "app_cognito_user_pool"
alias_attributes = ["email"]
auto_verified_attributes = ["email"]
account_recovery_setting {
recovery_mechanism {
name = "verified_email"
priority = 1
}
}
}
resource "aws_cognito_user_pool_client" "app_cognito_user_pool_client" {
name = "app_cognito_user_pool_client"
user_pool_id = aws_cognito_user_pool.app_cognito_user_pool.id
prevent_user_existence_errors = "ENABLED"
supported_identity_providers = ["COGNITO"]
}
resource "aws_cognito_user_pool_domain" "app_cognito_user_pool_domain" {
domain = "app"
user_pool_id = aws_cognito_user_pool.app_cognito_user_pool.id
}
Run Code Online (Sandbox Code Playgroud)
无论我尝试什么,我总是选择Username,而不是电子邮件地址或电话号码。我希望用户池不要使用用户名,而是使用电子邮件地址。
我缺少哪些 …
amazon-web-services amazon-cognito terraform terraform-provider-aws
我正在尝试使用(私有)远程 terraform 模块,并尝试将不同的提供程序传递给它。对于远程模块,没有定义提供程序,据我了解,它将使用本地提供程序。
\n我似乎无法让它使用提供者别名 - 这里有一些文件在起作用:
\n# main.tf\nprovider "aws" {\n region = var.aws_region\n\n}\n\nprovider "aws" {\n alias = "replica_region"\n region = var.replica_region\n}\n\nterraform {\n backend "s3" {\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n# s3.tf\nmodule "some-remote-module" {\n source = 'git::ssh.......'\n providers = {\n aws = aws.replica_region\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n每当我计划(使用 terragrunt)时,该区域就是主要 aws 提供程序配置的区域。我也收到以下警告:
\n\xe2\x94\x82 Warning: Reference to undefined provider\n\xe2\x94\x82\n\xe2\x94\x82 on s3.tf line 12, in module "some-remote-module":\n\xe2\x94\x82 12: aws = aws.replica_region\n\xe2\x94\x82\n\xe2\x94\x82 There is no explicit declaration for local provider name "aws" in\n\xe2\x94\x82 module.some-remote-module, so Terraform …Run Code Online (Sandbox Code Playgroud) terraform terragrunt terraform-provider-aws terraform-modules
我使用的是 Terraform 1.3.5,这个模块之前工作得很好,直到我重命名了该模块。现在我收到此错误:
\nError: creating EventBridge Target (cleanup-terraform-20221130175229684800000001): ValidationException: RoleArn is required for target arn:aws:events:us-east-1:123456789012:api-destination/services-destination/c187090f-268b-4d9b-b09d-f9b077e0c0cf.\n\xe2\x94\x82 status code: 400, request id: 63dc6425-2a94-4f66-b7c2-106b0607d964\n\xe2\x94\x82\n\xe2\x94\x82 with module.a-eventbridge-trigger.aws_cloudwatch_event_target.api_destination,\n\xe2\x94\x82 on ..\\a-eventbridge-trigger\\main.tf line 61, in resource "aws_cloudwatch_event_target" "api_destination":\n\xe2\x94\x82 61: resource "aws_cloudwatch_event_target" "api_destination" {\nRun Code Online (Sandbox Code Playgroud)\nmain.tf以下是模块中的完整内容:
# configures api connection\nresource "aws_cloudwatch_event_connection" "auth" {\n name = "services-token"\n description = "Gets oauth bearer token"\n authorization_type = "OAUTH_CLIENT_CREDENTIALS"\n\n auth_parameters {\n oauth {\n authorization_endpoint = "${var.vars.apiBaseUrl}${var.vars.auth}"\n http_method = "POST"\n\n client_parameters {\n client_id = var.secretContent.Client_Id\n client_secret = var.secretContent.Client_Secret\n }\n\n oauth_http_parameters …Run Code Online (Sandbox Code Playgroud) 我想使用 Terraform 创建 EC2 实例。该实例应该有一些 EBS。
在文档中我读到 Terraform 提供了两种创建 EBS 的方法:
ebs_block_deviceaws_ebs_volume和aws_volume_attachment我想知道,我应该什么时候使用ebs_block_device?
文档
不幸的是,文档不太清楚(至少对我来说):
ebs_block_device?请参阅资源:aws_instance:
ebs_block_device- (可选)一个或多个配置块以及附加到实例的附加 EBS 块设备。块设备配置仅适用于资源创建。有关属性和漂移检测的详细信息,请参阅下面的块设备。当将 this 作为属性引用访问时,它是一组对象。
和
ebs_block_device目前, Terraform 无法自动检测现有资源配置的更改。要管理 EBS 块对实例的更改和附件,请改用aws_ebs_volume和aws_volume_attachment资源。如果您ebs_block_device在 上使用aws_instance,Terraform 将承担对实例的全套非根 EBS 块设备的管理,将其他块设备视为漂移。因此,不能与给定实例的外部和资源ebs_block_device混合。aws_ebs_volumeaws_volume_attachment
研究
我读:
plan/的更改apply,并且不会更改 AWS 中的任何内容,尽管进行了更改。plan。我正在尝试使用 Terraform 创建 EMR。我可以为配置参数指定一个本地文件,但我想知道是否可以在 S3 中指定一个 json 文件,如果可以,如何指定。
resource "aws_emr_cluster" "cluster" {
...
...
...
configurations = "${file("local/file/path/to/json/file")}"
...
...
}
Run Code Online (Sandbox Code Playgroud)
我想要的是能够指定一个 s3 文件路径。
我是新来的Terraform。我正在编写一个小脚本,将一个小的数据文件从我的机器放到aws S3存储桶中。
Terraform文件代码:
provider "aws" {
region = "us-east-1"
version = "~> 1.6"
}
terraform {
backend "s3" {
bucket = "${var.bucket_testing}"
kms_key_id = "arn:aws:kms:us-east-1:12345678900:key/12312313ed-34sd-6sfa-90cvs-1234asdfasd"
key = "testexport/exportFile.tfstate"
region = "us-east-1"
encrypt = true
}
}
data "aws_s3_bucket" "pr-ip" {
bucket = "${var.bucket_testing}"
}
resource "aws_s3_bucket_object" "put_file" {
bucket = "${data.aws_s3_bucket.pr-ip.id}"
key = "${var.file_path}/${var.file_name}"
source = "src/Datafile.txt"
etag = "${md5(file("src/Datafile.txt"))}"
kms_key_id = "arn:aws:kms:us-east-1:12345678900:key/12312313ed-34sd-6sfa-90cvs-1234asdfasd"
server_side_encryption = "aws:kms"
}
Run Code Online (Sandbox Code Playgroud)
终端错误
地形初始化
Terraform initialized in an empty directory!
The directory has …Run Code Online (Sandbox Code Playgroud) amazon-s3 amazon-web-services terraform terraform-provider-aws
我已经为 aws 架构创建了 terraform 脚本,其中包括 ec2 实例和 ec2 上的 jenkins。我是 jenkins 的新手,并试图弄清楚如何使用现有的 terraform 脚本将它与 bitbucket 集成。任何帮助将不胜感激。
bitbucket amazon-web-services jenkins terraform terraform-provider-aws
我正在尝试使用Terraform设置cloudfront dist和s3存储桶。当我运行terraform apply它返回以下错误:
- aws_s3_bucket.app:放置S3日志时出错:InvalidTargetBucketForLogging:您必须将日志传送组WRITE和READ_ACP权限授予目标存储桶
我的S3.tf文件:
data "aws_iam_policy_document" "s3_policy" {
policy_id = "PolicyForCloudFrontPrivateContent"
statement {
sid = "1"
actions = ["s3:GetObject"]
resources = ["arn:aws:s3:::${local.name_env}/*"]
principals {
type = "AWS"
identifiers = ["${aws_cloudfront_origin_access_identity.origin_access_identity.iam_arn}"]
}
}
}
resource "aws_s3_bucket" "app" {
bucket = "${local.name_env}"
policy = "${data.aws_iam_policy_document.s3_policy.json}"
logging {
target_bucket = "${local.logs_bucket}"
target_prefix = "app-${var.environment}"
}
versioning {
enabled = true
}
tags = "${local.tags}"
}
Run Code Online (Sandbox Code Playgroud) amazon-s3 amazon-cloudfront terraform terraform-provider-aws
我需要将文件夹上传到S3 Bucket。但是当我第一次申请时。它只是上传。但是我这里有两个问题:
terraform apply再次运行时,显示Apply complete! Resources: 0 added, 0 changed, 0 destroyed。我希望在运行terraform apply并创建新版本时始终上传所有内容。我究竟做错了什么?这是我的Terraform配置:
resource "aws_s3_bucket" "my_bucket" {
bucket = "my_bucket_name"
versioning {
enabled = true
}
}
resource "aws_s3_bucket_object" "file_upload" {
bucket = "my_bucket"
key = "my_bucket_key"
source = "my_files.zip"
}
output "my_bucket_file_version" {
value = "${aws_s3_bucket_object.file_upload.version_id}"
}
Run Code Online (Sandbox Code Playgroud) amazon-s3 amazon-web-services terraform terraform-provider-aws