#######################################################################################
# Copyright ETSI Contributors and Others.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#######################################################################################

---
apiVersion: ec2.aws.upbound.io/v1beta1
kind: EIP
metadata:
  name: ${cluster_resource_name}-eip
  labels:
    provider: aws
    cluster: ${cluster_resource_name}
    type: eip
spec:
  forProvider:
    region: ${cluster_location}
    domain: vpc
    tags:
      key: Name
      value: ${cluster_name}-eip
  # Use in case you wanted to use different credentials (i.e., ProviderConfig different than default)
  providerConfigRef:
    name: ${providerconfig_name}

---
apiVersion: ec2.aws.upbound.io/v1beta1
kind: InternetGateway
metadata:
  name: ${cluster_resource_name}-igw
  labels:
    provider: aws
    cluster: ${cluster_resource_name}
    type: igw
spec:
  forProvider:
    region: ${cluster_location}
    vpcIdSelector:
      matchLabels:
        provider: aws
        cluster: ${cluster_resource_name}
    tags:
      Name: ${cluster_name}-igw
  # Use in case you wanted to use different credentials (i.e., ProviderConfig different than default)
  providerConfigRef:
    name: ${providerconfig_name}

---
apiVersion: ec2.aws.upbound.io/v1beta1
kind: NATGateway
metadata:
  name: ${cluster_resource_name}-natgw
  labels:
    provider: aws
    cluster: ${cluster_resource_name}
    type: natgw
spec:
  forProvider:
    region: ${cluster_location}
    connectivityType: public
    allocationIdSelector:
      matchLabels:
        provider: aws
        cluster: ${cluster_resource_name}
        type: eip
    subnetIdSelector:
      matchLabels:
        type: subnet
        provider: aws
        cluster: ${cluster_resource_name}
        zone: ${cluster_location}a
        access: public
    tags:
      Name: ${cluster_name}-natgw
  # Use in case you wanted to use different credentials (i.e., ProviderConfig different than default)
  providerConfigRef:
    name: ${providerconfig_name}
