From 87964a7cc958babe263b4dbeff2119ba09b4867a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20N=C3=A9meth?= Date: Tue, 27 Feb 2024 22:10:27 +0300 Subject: [PATCH] EC2: Fix vpn gateway tags and type (#7397) --- .../ec2/responses/virtual_private_gateways.py | 5 ++--- other_langs/terraform/ec2/provider.tf | 22 +++++++++++++++++++ other_langs/terraform/ec2/vpc.tf | 18 +++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 other_langs/terraform/ec2/provider.tf create mode 100644 other_langs/terraform/ec2/vpc.tf diff --git a/moto/ec2/responses/virtual_private_gateways.py b/moto/ec2/responses/virtual_private_gateways.py index 5f2f8e425..8c00563c4 100644 --- a/moto/ec2/responses/virtual_private_gateways.py +++ b/moto/ec2/responses/virtual_private_gateways.py @@ -13,7 +13,7 @@ class VirtualPrivateGateways(EC2BaseResponse): gateway_type = self._get_param("Type") amazon_side_asn = self._get_param("AmazonSideAsn") availability_zone = self._get_param("AvailabilityZone") - tags = self._parse_tag_specification().get("virtual-private-gateway", {}) + tags = self._parse_tag_specification().get("vpn-gateway", {}) vpn_gateway = self.ec2_backend.create_vpn_gateway( gateway_type=gateway_type, amazon_side_asn=amazon_side_asn, @@ -78,7 +78,7 @@ DESCRIBE_VPN_GATEWAYS_RESPONSE = """ {{ vpn_gateway.amazon_side_asn }} {% endif %} {{ vpn_gateway.state }} - {{ vpn_gateway.id }} + {{ vpn_gateway.type }} {{ vpn_gateway.availability_zone }} {% for attachment in vpn_gateway.attachments.values() %} @@ -88,7 +88,6 @@ DESCRIBE_VPN_GATEWAYS_RESPONSE = """ {% endfor %} - {% for tag in vpn_gateway.get_tags() %} diff --git a/other_langs/terraform/ec2/provider.tf b/other_langs/terraform/ec2/provider.tf new file mode 100644 index 000000000..ad10e3da9 --- /dev/null +++ b/other_langs/terraform/ec2/provider.tf @@ -0,0 +1,22 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + } + } +} + +provider "aws" { + region = "us-east-1" + s3_use_path_style = true + skip_credentials_validation = true + skip_metadata_api_check = true + skip_requesting_account_id = true + + endpoints { + ec2 = "http://localhost:5000" + } + + access_key = "my-access-key" + secret_key = "my-secret-key" +} \ No newline at end of file diff --git a/other_langs/terraform/ec2/vpc.tf b/other_langs/terraform/ec2/vpc.tf new file mode 100644 index 000000000..1d6d3ac84 --- /dev/null +++ b/other_langs/terraform/ec2/vpc.tf @@ -0,0 +1,18 @@ +module "vpc" { + source = "terraform-aws-modules/vpc/aws" + + name = "my-vpc" + cidr = "10.0.0.0/16" + + azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"] + private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"] + public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"] + + enable_nat_gateway = true + enable_vpn_gateway = true + + tags = { + Terraform = "true" + Environment = "dev" + } +} \ No newline at end of file