from troposphere.ec2 import (
    VPC,
)

from .template import template


vpc = VPC(
    "Vpc",
    template=template,
    CidrBlock="10.0.0.0/16",
)

from troposphere import (
    Ref,
)

from troposphere.ec2 import (
    InternetGateway,
    VPC,
    VPCGatewayAttachment,
)

from .template import template


vpc = VPC(
    "Vpc",
    template=template,
    CidrBlock="10.0.0.0/16",
)


# Allow outgoing to outside VPC
internet_gateway = InternetGateway(
    "InternetGateway",
    template=template,
)


# Attach Gateway to VPC
VPCGatewayAttachment(
    "GatewayAttachement",
    template=template,
    VpcId=Ref(vpc),
    InternetGatewayId=Ref(internet_gateway),
)

Attach an `InternetGateway` to the `VPC`
Attach an `InternetGateway` to the `VPC`

+ from troposphere import (
+     Ref,
+ )
+ 
  from troposphere.ec2 import (
+     InternetGateway,
      VPC,
+     VPCGatewayAttachment,
  )
  
  from .template import template
  
  
  vpc = VPC(
      "Vpc",
      template=template,
      CidrBlock="10.0.0.0/16",
  )
  
+ 
+ # Allow outgoing to outside VPC
+ internet_gateway = InternetGateway(
+     "InternetGateway",
+     template=template,
+ )
+ 
+ 
+ # Attach Gateway to VPC
+ VPCGatewayAttachment(
+     "GatewayAttachement",
+     template=template,
+     VpcId=Ref(vpc),
+     InternetGatewayId=Ref(internet_gateway),
+ )
+ 
Attach an `InternetGateway` to the `VPC`
## Code Before:
from troposphere.ec2 import (
    VPC,
)

from .template import template


vpc = VPC(
    "Vpc",
    template=template,
    CidrBlock="10.0.0.0/16",
)

## Instruction:
Attach an `InternetGateway` to the `VPC`
## Code After:
from troposphere import (
    Ref,
)

from troposphere.ec2 import (
    InternetGateway,
    VPC,
    VPCGatewayAttachment,
)

from .template import template


vpc = VPC(
    "Vpc",
    template=template,
    CidrBlock="10.0.0.0/16",
)


# Allow outgoing to outside VPC
internet_gateway = InternetGateway(
    "InternetGateway",
    template=template,
)


# Attach Gateway to VPC
VPCGatewayAttachment(
    "GatewayAttachement",
    template=template,
    VpcId=Ref(vpc),
    InternetGatewayId=Ref(internet_gateway),
)
