“wait_for_ready_timeout”的默认设置为 20 分钟。在“aws_elastic_beanstalk_application_version”资源中,我将其设置为 40 分钟,希望覆盖默认值。它只会运行 20 分钟然后超时。
我进入 AWS 控制台并手动执行了此操作。我发现在 AWS 控制台中手动执行此操作需要 20 多分钟。我不明白为什么它在 20 分钟时超时,应该运行 40 分钟。
没什么特别的,下面的代码使用另一个文件中的一些变量,就是这样。命令只是 - terraform apply
#Provider
provider "aws" {
#version = "~> 1.5"
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}
#S3 Bucket
resource "aws_s3_bucket" "eb_staging" {
bucket_prefix = "a_prefix-automate-eb1"
}
#S3 Bucket Object
#take zipped folder from working directory and upload it to S3 as etag hashed file
resource "aws_s3_bucket_object" "eb_staging" {
bucket = "${aws_s3_bucket.eb_staging.id}"
key = "v003"
source = "${var.eb_source_stage_path}"
etag = "${md5(file("${var.eb_source_stage_path}"))}"
}
#Application
resource "aws_elastic_beanstalk_application" "mvc-site" {
name = "mvc-site"
description = "mvc-site-desc"
}
#Application Version
resource "aws_elastic_beanstalk_application_version" "mvc_staging" {
name = "v003-mvc-site"
application = "mvc-site"
description = "app version staging mvc staging"
bucket = "${aws_s3_bucket.eb_staging.id}"
key = "${aws_s3_bucket_object.eb_staging.id}"
}
#Environment
resource "aws_elastic_beanstalk_environment" "mvc-staging" {
#still timeout at 20....==========================================
wait_for_ready_timeout = "40m"
name = "mvc-staging"
application = "${aws_elastic_beanstalk_application.mvc-site.name}"
solution_stack_name = "${var.eb_solution_stack}"
version_label = "${aws_elastic_beanstalk_application_version.mvc_staging.name}"
}