FlexibleEngineCloud / terraform-flexibleengine-vpc

Terraform module which creates VPC resources on Flexible Engine
Apache License 2.0
3 stars 7 forks source link

Default route table + CIDR in module outputs #8

Open jbphilippe-orange opened 1 year ago

jbphilippe-orange commented 1 year ago

Hi,

I would like to add new outputs in this module, for default route table ID, Name, and CIDR of the VPC. Not mandatory, but it could be useful , to use these outputs with another resources

In main.tf , we could add this :

data "flexibleengine_vpc_route_table" "default" {
  vpc_id = flexibleengine_vpc_v1.vpc[0].id

  depends_on = [flexibleengine_vpc_v1.vpc, flexibleengine_vpc_subnet_v1.vpc_subnets]
}

Then in outputs.tf :

output "default_rtb_id" {
  description = "id of the VPC route table (default)"
  value          = data.flexibleengine_vpc_route_table.default.id
}

output "default_rtb_name" {
  description = "Name of the VPC route table (default)"
  value          = data.flexibleengine_vpc_route_table.default.name
}

output "vpc_cidr" {
  description = "CIDR of the created VPC"
  value          = var.vpc_cidr
}