feat: adding custom routes for AWS

This commit is contained in:
Pierre Mavro
2021-12-23 12:31:13 +01:00
committed by Pierre Mavro
parent 3d3100d7e5
commit b4402cf03b
4 changed files with 25 additions and 0 deletions

View File

@@ -87,6 +87,13 @@ resource "aws_route_table" "eks_cluster" {
gateway_id = aws_internet_gateway.eks_cluster.id
}
{% for route in vpc_custom_routing_table %}
route {
cidr_block = "{{ route.destination }}"
gateway_id = "{{ route.target }}"
}
{% endfor %}
tags = local.tags_eks_vpc_public
}

View File

@@ -41,6 +41,14 @@ resource "aws_route_table" "eks_cluster" {
gateway_id = aws_internet_gateway.eks_cluster.id
}
// todo(pmavro): add tests for it when it will be available in the SDK
{% for route in vpc_custom_routing_table %}
route {
cidr_block = "{{ route.destination }}"
gateway_id = "{{ route.target }}"
}
{% endfor %}
tags = local.tags_eks_vpc
}

View File

@@ -54,6 +54,13 @@ pub enum VpcQoveryNetworkMode {
WithoutNatGateways,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VpcCustomRoutingTable {
description: String,
destination: String,
target: String,
}
impl fmt::Display for VpcQoveryNetworkMode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self)
@@ -81,6 +88,7 @@ pub struct Options {
pub vpc_qovery_network_mode: VpcQoveryNetworkMode,
pub vpc_cidr_block: String,
pub eks_cidr_subnet: String,
pub vpc_custom_routing_table: Vec<VpcCustomRoutingTable>,
pub eks_access_cidr_blocks: Vec<String>,
pub rds_cidr_subnet: String,
pub documentdb_cidr_subnet: String,
@@ -416,6 +424,7 @@ impl<'a> EKS<'a> {
context.insert("aws_terraform_backend_bucket", "qovery-terrafom-tfstates");
context.insert("aws_terraform_backend_dynamodb_table", "qovery-terrafom-tfstates");
context.insert("vpc_cidr_block", &vpc_cidr_block);
context.insert("vpc_custom_routing_table", &self.options.vpc_custom_routing_table);
context.insert("s3_kubeconfig_bucket", &self.kubeconfig_bucket_name());
// AWS - EKS

View File

@@ -169,6 +169,7 @@ impl Cluster<AWS, Options> for AWS {
vpc_qovery_network_mode: VpcQoveryNetworkMode::WithoutNatGateways,
vpc_cidr_block: "10.0.0.0/16".to_string(),
eks_cidr_subnet: "20".to_string(),
vpc_custom_routing_table: vec![],
eks_access_cidr_blocks: secrets
.EKS_ACCESS_CIDR_BLOCKS
.unwrap()