. | `number` | n/a | yes |
| [cloud_provider](#input_cloud_provider) | Cloud provider name if any | `string` | `null` | no |
| [context](#input_context) | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional_tag_map, which are merged. | object({
enabled = bool
namespace = string
cloud_provider = string
account = string
region = string
environment = string
stage = string
name = string
delimiter = string
attributes = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
label_order = list(string)
id_length_limit = number
}) | {
"account": null,
"additional_tag_map": {},
"attributes": [],
"cloud_provider": null,
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_order": [],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"region": null,
"stage": null,
"tags": {}
} | no |
+| [ddos_protection_plan](#input_ddos_protection_plan) | configuración de un plan de protección contra ataques de denegación de servicio distribuido | map(object({
id = string #id de la configuración de un plan de protección contra ataques de denegación de servicio distribuido
enable = bool #se define si esta activado o no
})) | n/a | yes |
+| [dns_servers](#input_dns_servers) | Lista de direcciones IP de servidores DNS | `list(string)` | [
"10.0.0.4",
"10.0.0.5"
]
| no |
| [domain](#input_domain) | TLD to use when deploying assets | `string` | `null` | no |
+| [edge_zone](#input_edge_zone) | Especifica la zona perimetral dentro de la región de Azure en la que debe existir esta red virtual. Cambiar esto obliga a crear una nueva red virtual. | `string` | n/a | yes |
| [enabled](#input_enabled) | Set to false to prevent the module from creating any resources | `bool` | `true` | no |
| [environment](#input_environment) | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | `string` | `null` | no |
+| [flow_timeout_in_minutes](#input_flow_timeout_in_minutes) | El tiempo de espera del flujo en minutos para la red virtual, que se usa para habilitar el seguimiento de conexiones para los flujos dentro de la máquina virtual. Los valores posibles están entre 4 y 30 minutos | `number` | n/a | yes |
| [name](#input_name) | Module name, e.g. 'app' or 'jenkins' | `string` | `"hi"` | no |
| [namespace](#input_namespace) | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no |
| [region](#input_region) | AWS region to deploy asset into | `string` | `null` | no |
| [stage](#input_stage) | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
+| [subnets](#input_subnets) | n/a | map(object({
name = string
address_space = string
resource_group_name = string
security_group = string
})) | n/a | yes |
| [tags](#input_tags) | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no |
+| [virtual_network](#input_virtual_network) | n/a | `string` | `"network"` | no |
## Outputs
| Name | Description |
diff --git a/main.tf b/main.tf
index 1bc1164..f6b0671 100644
--- a/main.tf
+++ b/main.tf
@@ -1,11 +1,67 @@
+#recursos locales (Zulunity)
# Local
locals {
tags = {}
}
-# Label
+# Default Label
module "default_label" {
- source = "git@gitlab.com:zulunity/terraform/modules/general/label.git?ref=0.0.0"
+ source = "git::https://gitlab.com/zulunity/terraform/modules/general/label.git?ref=0.0.0"
name = var.name
tags = merge(var.tags, local.tags)
}
+
+# Secret Label
+module "secrets_label" {
+ source = "git::https://gitlab.com/zulunity/terraform/modules/general/label.git"
+ context = module.default_label.normalized_context
+ attributes = ["secret"]
+}
+#----------------------------------------------------------------------------------------------
+#recusos externos necesarios para el modulo
+resource "azurerm_resource_group" "example" {
+ name = "${var.name}_group"
+ location = var.region #recuerda que en azure la region o "location cambia"
+}
+
+resource "azurerm_network_security_group" "example" {
+ name = "${var.name}_segurity-network-group"
+ location = azurerm_resource_group.example.location
+ resource_group_name = azurerm_resource_group.example.name
+}
+
+resource "azurerm_virtual_network" "example" {
+ name = var.virtual_network
+ location = azurerm_resource_group.example.location
+ resource_group_name = azurerm_resource_group.example.name
+ address_space = var.address_space
+ dns_servers = var.dns_servers
+ bgp_community = var.bgp_community
+ edge_zone = var.edge_zone
+ flow_timeout_in_minutes = var.flow_timeout_in_minutes
+
+ #este es un bloque de codigo que define el como especificar la configuración de un plan de protección contra ataques de denegación de servicio distribuido
+ dynamic "ddos_protection_plan" {
+ for_each = var.ddos_protection_plan
+
+ content {
+ id = ddos_protection_plan.value.id
+ enable = ddos_protection_plan.value.id
+ }
+ }
+ tags = module.default_label.tags
+}
+
+
+
+resource "azurerm_subnet" "example" {
+ for_each = var.subnets
+
+
+ name = each.value.name
+ resource_group_name = azurerm_virtual_network.example.resource_group_name
+ virtual_network_name = azurerm_virtual_network.example.name
+ address_prefixes = [each.value.address_prefix]
+
+}
+
diff --git a/variables.tf b/variables.tf
index f10bca3..cbabd12 100644
--- a/variables.tf
+++ b/variables.tf
@@ -120,3 +120,58 @@ variable "tags" {
#
# Variables specific to this module
#
+
+variable "virtual_network" {
+ type = string
+ default = "network"
+}
+
+locals {
+ virtual_network = "${var.name}_${var.virtual_network}"
+}
+
+variable "address_space" {
+ type = list(string)
+ default = ["10.0.0.0/16"]
+ description = "El espacio de direcciones que se usa en la red virtual. Puede proporcionar más de un espacio de direcciones."
+}
+
+variable "dns_servers" {
+ type = list(string)
+ default = ["10.0.0.4", "10.0.0.5"]
+ description = "Lista de direcciones IP de servidores DNS"
+}
+variable "bgp_community" {
+ type = number
+ description = " El atributo de comunidad BGP en formato :."
+}
+
+variable "edge_zone" {
+ type = string
+ description = " Especifica la zona perimetral dentro de la región de Azure en la que debe existir esta red virtual. Cambiar esto obliga a crear una nueva red virtual."
+
+}
+
+variable "flow_timeout_in_minutes" {
+ type = number
+ description = "El tiempo de espera del flujo en minutos para la red virtual, que se usa para habilitar el seguimiento de conexiones para los flujos dentro de la máquina virtual. Los valores posibles están entre 4 y 30 minutos"
+}
+
+variable "ddos_protection_plan" {
+ type = map(object({
+ id = string #id de la configuración de un plan de protección contra ataques de denegación de servicio distribuido
+ enable = bool #se define si esta activado o no
+ }))
+ description = "configuración de un plan de protección contra ataques de denegación de servicio distribuido "
+}
+
+variable "subnets" {
+ type = map(object({
+ name = string
+ address_space = string
+ resource_group_name = string
+ security_group = string
+ }))
+
+}
+
diff --git a/versions.tf b/versions.tf
index 7117131..ae95fef 100644
--- a/versions.tf
+++ b/versions.tf
@@ -1,3 +1,12 @@
terraform {
+ required_providers {
+ azurerm = {
+ source = "hashicorp/azurerm"
+ version = "=3.0.0"
+ }
+ }
required_version = ">= 1.0"
}
+provider "azurerm" {
+ features {}
+}