EC2: Fix vpn gateway tags and type (#7397)

This commit is contained in:
Gábor Németh 2024-02-27 22:10:27 +03:00 committed by GitHub
parent 3064a28202
commit 87964a7cc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 42 additions and 3 deletions

View File

@ -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 = """
<amazonSideAsn>{{ vpn_gateway.amazon_side_asn }}</amazonSideAsn>
{% endif %}
<state>{{ vpn_gateway.state }}</state>
<type>{{ vpn_gateway.id }}</type>
<type>{{ vpn_gateway.type }}</type>
<availabilityZone>{{ vpn_gateway.availability_zone }}</availabilityZone>
<attachments>
{% for attachment in vpn_gateway.attachments.values() %}
@ -88,7 +88,6 @@ DESCRIBE_VPN_GATEWAYS_RESPONSE = """
</item>
{% endfor %}
</attachments>
<tagSet/>
<tagSet>
{% for tag in vpn_gateway.get_tags() %}
<item>

View File

@ -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"
}

View File

@ -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"
}
}