如何解决AWS Transfer Update-Server抛出错误
我正在使用terraform创建aws sftp服务器,并尝试使用IP whitelisting保护我的服务器。
Terraform aws_transfer_server
命令目前仅支持endpoint_types,例如PUBLIC或VPC_ENDPOINT。因此,我使用null_resource
执行aws命令以在创建sftp服务器后更新它。地形片段如下:
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
参数的一部分。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。