我正在使用 Terraform 脚本创建 aws elastic beanstalk 环境,我需要在实例启动时启动 shell 脚本
我已经尝试过以下操作
resource "aws_elastic_beanstalk_environment" "Environment" {
name = "${var.ebs_env_name}"
application = "${var.ebs_app_name}"
---
---
---
setting = {
namespace = "aws:autoscaling:launchconfiguration"
name = "user_data"
value = "${file("user-data.sh")}"
}
}
这是抛出错误
应用计划时出错:
发生 1 个错误:
aws_elastic_beanstalk_environment.Environment:ConfigurationValidationException:配置验证异常:无效的选项规范(命名空间:'aws:autoscaling:launchconfiguration',OptionName:'user_data'):未知的配置设置。
状态码:400,请求 ID:xxxxx-xxxxxx
请帮忙
感谢您的回答,我找到了解决方案
我创建了一个文件夹 .ebextensions 并在该文件夹中创建了一个名为 99delayed_job.config 的文件(您可以给出任何名称)
commands:
create_post_dir:
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/pre"
ignoreErrors: true
files:
/opt/elasticbeanstalk/hooks/appdeploy/pre/99_restart_delayed_job.sh:
group: root
mode: "000755"
owner: root
content: |-
#!/usr/bin/env bash
<My shell script here>
A 并使用“Dockerrun.aws.json”进行压缩,我将这个 zip 发送到 s3 并用于部署
工作正常:)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)