amazon-web-services - aws transfer update-server 抛出错误
问题描述
我正在使用 terraform 创建一个 aws sftp 服务器并尝试使用IP 白名单来保护我的服务器。
Terraformaws_transfer_server
命令目前仅支持PUBLIC 或 VPC_ENDPOINT 等端点类型。所以我在null_resource
创建 sftp 服务器后使用执行 aws 命令来更新它。terraform 片段如下:
resource "null_resource" "update_sftp_server" {
provisioner "local-exec" {
command = <<EOF
aws transfer update-server --server-id ${aws_transfer_server.sftp.id} --endpoint-type VPC --endpoint-details SubnetIds="${join("\", \"", var.subnet_ids)}", AddressAllocationIds="${join("\", \"", toset(aws_eip.nlb.*.id))}", VPCEndpointID="${aws_vpc_endpoint.transfer.id}", VpcId="${var.vpc_id}"
EOF
}
depends_on = [aws_transfer_server.sftp, aws_vpc_endpoint.transfer]
}
这将执行以下 aws 命令
aws transfer update-server --server-id s-######## --endpoint-type VPC --endpoint-details SubnetIds="subnet-#####", "subnet-#####", AddressAllocationIds="eipalloc-######", "eipalloc-######", VPCEndpointID="vpce-#######", VpcId="vpc-#####"
但我收到如下错误:
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
Unknown options: AddressAllocationIds=eipalloc-######, eipalloc-######, VPCEndpointID=vpce-######, VpcId=vpc-######, subnet-######
有人可以帮我知道为什么会抛出这个错误吗?我的环境详细信息如下:
Terraform v0.12.28
provider.aws v3.0.0
provider.null v2.1.2
aws-cli/2.0.33 Python/3.7.7 Windows/10 botocore/2.0.0dev37
解决方案
您是否尝试过构建没有空格的参数列表?所以它看起来像SubnetIds="subnet-#####","subnet-#####",AddressAllocationIds="eipalloc-######","eipalloc-######",VPCEndpointID="vpce-#######",VpcId="vpc-#####"
?
否则,当命令行被分解为标记时,这些位中的大部分将不会被解析为--endpoint-details
参数的一部分。
推荐阅读
- node.js - 在 Heroku [Node.js/React] 上部署 Socket.io 网站时出错
- javascript - 全局变量干扰其他代码我想将它作为局部变量放入这些函数中,使其全部放入 1 个大函数中
- zipkin - 配置 OpenTelemetry Collector 以导出 Zipkin 跟踪
- django - 是否有使用可扩展过滤器创建 Django 查询的最佳实践?
- pandas - 如何将我的列名放在熊猫数据框中的一行中?
- html - 为什么按钮会向下移动,尽管它被指定为内联?
- python - tKinter 和 PySimpleGUI 中的帧大小问题
- vue.js - 如果 API 变量发生变化,如何更新 vue 变量?
- c# - 在 Selected 事件之后访问 SQLDataSource 数据
- javascript - 将类型文件的输入更改为图标 - 如何删除路径预览并更改样式?反应,JS