【问题标题】:Terraform aws_storagegateway_gateway not finding VPC EndpointTerraform aws_storagegateway_gateway 未找到 VPC 端点
【发布时间】:2021-11-01 01:19:36
【问题描述】:

我正在尝试通过 Terraform 启动一个 S3 文件网关 (AWS Storage Gateway),其中包含 EC2 托管和 Storage Gateway 的 VPC 端点。

我已经能够在私有子网中启动 Storage Gateway EC2,然后在公有子网中启动第二个 EC2 实例,以便检索网关的激活密钥 (https://docs.aws.amazon.com/storagegateway/latest/userguide/get-activation-key.html)。

不幸的是,当我在 Terraform 中为 activation_key 提供值时,它似乎忽略了 gateway_vpc_endpoint,而只是使用公共端点创建了存储网关。

使用的代码:

resource "aws_storagegateway_gateway" "s3_file_gateway" {
  gateway_vpc_endpoint      = aws_vpc_endpoint.storage_gateway.dns_entry[0].dns_name
  activation_key            = "XXXX-XXXX-XXXX-XXXX-XXXX"
  gateway_name              = "Storage-Gateway"
  gateway_timezone          = var.gateway_timezone
  gateway_type              = var.gateway_type
  cloudwatch_log_group_arn  = aws_cloudwatch_log_group.storage_gateway.arn
  tags                      = var.tags

  lifecycle {
    ignore_changes = [smb_active_directory_settings, gateway_ip_address]
  }
}

有没有人遇到过这个并能够解决它?

【问题讨论】:

    标签: terraform terraform-provider-aws aws-storage-gateway


    【解决方案1】:

    这个问题现在已经有几个月了,但是当您连接到第二个 EC2 以从网关 EC2 检索激活密钥时,您可能会卷曲错误的 URL。

    您可能一直遵循本文档中的说明: https://docs.aws.amazon.com/storagegateway/latest/userguide/get-activation-key.html

    实际上,这是对您要实现的目标更有用的文档: https://docs.aws.amazon.com/filegateway/latest/files3/gateway-private-link.html

    这表明您应该通过 curl 获取激活密钥的 URL 格式为:

    http://虚拟机 IP ADDRESS/?gatewayType=FILE_S3&activationRegion=REGION&vpcEndpoint=VPCEndpointDNSname&no_redirect

    【讨论】:

      猜你喜欢
      • 2020-05-06
      • 1970-01-01
      • 2021-01-18
      • 2022-07-07
      • 1970-01-01
      • 1970-01-01
      • 2021-07-25
      • 2021-08-24
      • 2020-09-17
      相关资源
      最近更新 更多