diff --git a/README.md b/README.md index b5915de..86d7e19 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,9 @@ ## Providers -No providers. +| Name | Version | +|------|---------| +| [azurerm](#provider\_azurerm) | >= 3.0.0 | ## Modules @@ -23,13 +25,37 @@ No modules. ## Resources -No resources. +| Name | Type | +|------|------| +| [azurerm_public_ip.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip) | resource | ## Inputs -No inputs. +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [allocation\_method](#input\_allocation\_method) | Required) Defines the allocation method for this IP address. Possible values are Static or Dynamic. | `string` | `"Static"` | no | +| [create\_app\_gateway](#input\_create\_app\_gateway) | description | `bool` | `true` | no | +| [ddos\_protection\_mode](#input\_ddos\_protection\_mode) | (Optional) The DDoS protection mode of the public IP. Possible values are Disabled, Enabled, and VirtualNetworkInherited. Defaults to VirtualNetworkInherited. | `string` | `"VirtualNetworkInherited"` | no | +| [ddos\_protection\_plan\_id](#input\_ddos\_protection\_plan\_id) | (Optional) The ID of DDoS protection plan associated with the public IP. | `string` | `null` | no | +| [domain\_name\_label](#input\_domain\_name\_label) | (Optional) Label for the Domain Name. Will be used to make up the FQDN. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system. | `string` | `null` | no | +| [edge\_zone](#input\_edge\_zone) | (Optional) Specifies the Edge Zone within the Azure Region where this Public IP should exist. Changing this forces a new Public IP to be created. | `string` | `null` | no | +| [idle\_timeout\_in\_minutes](#input\_idle\_timeout\_in\_minutes) | (Optional) Specifies the timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. | `number` | `4` | no | +| [ip\_tags](#input\_ip\_tags) | (Optional) A mapping of IP tags to assign to the public IP. Changing this forces a new resource to be created. | `map(string)` | `{}` | no | +| [ip\_version](#input\_ip\_version) | (Optional) The IP Version to use, IPv6 or IPv4. Changing this forces a new resource to be created. | `string` | `"IPv4"` | no | +| [location](#input\_location) | (Required) Specifies the supported Azure location where the Public IP should exist. Changing this forces a new resource to be created. | `string` | n/a | yes | +| [pip\_name](#input\_pip\_name) | (Required) Specifies the name of the Public IP. Changing this forces a new Public IP to be created. | `string` | n/a | yes | +| [public\_ip\_prefix\_id](#input\_public\_ip\_prefix\_id) | (Optional) If specified then public IP address allocated will be provided from the public IP prefix resource. Changing this forces a new resource to be created. | `string` | `null` | no | +| [resource\_group\_name](#input\_resource\_group\_name) | (Required) The name of the Resource Group where this Public IP should exist. Changing this forces a new Public IP to be created. | `string` | n/a | yes | +| [reverse\_fqdn](#input\_reverse\_fqdn) | (Optional) A fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN. | `string` | `null` | no | +| [sku](#input\_sku) | (Optional) The SKU of the Public IP. Accepted values are Basic and Standard. Defaults to Standard. Changing this forces a new resource to be created. | `string` | `"Standard"` | no | +| [sku\_tier](#input\_sku\_tier) | (Optional) The SKU Tier that should be used for the Public IP. Possible values are Regional and Global. Defaults to Regional. Changing this forces a new resource to be created. | `string` | `"Regional"` | no | +| [tags](#input\_tags) | (Optional) A mapping of tags to assign to the resource. | `map(string)` | `{}` | no | +| [zones](#input\_zones) | (Optional) A collection containing the availability zone to allocate the Public IP in. Changing this forces a new resource to be created. | `list(string)` | `[]` | no | ## Outputs -No outputs. +| Name | Description | +|------|-------------| +| [ip\_address](#output\_ip\_address) | The IP address value that was allocated. | +| [pip\_id](#output\_pip\_id) | The ID of this Public IP. | diff --git a/main.tf b/main.tf index e69de29..48018fc 100644 --- a/main.tf +++ b/main.tf @@ -0,0 +1,27 @@ +resource "azurerm_public_ip" "this" { + count = var.create_app_gateway ? 1 : 0 + + name = var.pip_name + resource_group_name = var.resource_group_name + location = var.location + allocation_method = var.allocation_method + zones = var.zones + ddos_protection_mode = var.ddos_protection_mode + ddos_protection_plan_id = var.ddos_protection_plan_id + domain_name_label = var.domain_name_label + edge_zone = var.edge_zone + idle_timeout_in_minutes = var.idle_timeout_in_minutes + ip_tags = var.ip_tags + ip_version = var.ip_version + public_ip_prefix_id = var.public_ip_prefix_id + reverse_fqdn = var.reverse_fqdn + sku = var.sku + sku_tier = var.sku_tier + + tags = var.tags +} + + +/* resource "azurerm_application_gateway" "this" { + count = var.create_app_gateway ? 1 : 0 +} */ diff --git a/outputs.tf b/outputs.tf index e69de29..4aeafdd 100644 --- a/outputs.tf +++ b/outputs.tf @@ -0,0 +1,9 @@ +output "pip_id" { + description = "The ID of this Public IP." + value = try(azurerm_public_ip.this[0].id, "") +} + +output "ip_address" { + description = "The IP address value that was allocated." + value = try(azurerm_public_ip.this[0].ip_address, "") +} diff --git a/variables.tf b/variables.tf index e69de29..5e36688 100644 --- a/variables.tf +++ b/variables.tf @@ -0,0 +1,104 @@ +variable "create_app_gateway" { + type = bool + description = "description" + default = true +} + +variable "pip_name" { + type = string + description = "(Required) Specifies the name of the Public IP. Changing this forces a new Public IP to be created." +} + +variable "resource_group_name" { + type = string + description = "(Required) The name of the Resource Group where this Public IP should exist. Changing this forces a new Public IP to be created." +} + +variable "location" { + type = string + description = "(Required) Specifies the supported Azure location where the Public IP should exist. Changing this forces a new resource to be created." +} + +variable "allocation_method" { + type = string + description = "Required) Defines the allocation method for this IP address. Possible values are Static or Dynamic." + default = "Static" +} + +variable "zones" { + type = list(string) + description = "(Optional) A collection containing the availability zone to allocate the Public IP in. Changing this forces a new resource to be created." + default = [] +} + +variable "ddos_protection_mode" { + type = string + description = "(Optional) The DDoS protection mode of the public IP. Possible values are Disabled, Enabled, and VirtualNetworkInherited. Defaults to VirtualNetworkInherited." + default = "VirtualNetworkInherited" +} + +variable "ddos_protection_plan_id" { + type = string + description = "(Optional) The ID of DDoS protection plan associated with the public IP." + default = null +} + +variable "domain_name_label" { + type = string + description = "(Optional) Label for the Domain Name. Will be used to make up the FQDN. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system." + default = null +} + +variable "edge_zone" { + type = string + description = "(Optional) Specifies the Edge Zone within the Azure Region where this Public IP should exist. Changing this forces a new Public IP to be created." + default = null +} + +variable "idle_timeout_in_minutes" { + type = number + description = "(Optional) Specifies the timeout for the TCP idle connection. The value can be set between 4 and 30 minutes." + default = 4 +} + +variable "ip_tags" { + type = map(string) + description = "(Optional) A mapping of IP tags to assign to the public IP. Changing this forces a new resource to be created." + default = {} +} + +variable "ip_version" { + type = string + description = "(Optional) The IP Version to use, IPv6 or IPv4. Changing this forces a new resource to be created." + default = "IPv4" +} + +variable "public_ip_prefix_id" { + type = string + description = "(Optional) If specified then public IP address allocated will be provided from the public IP prefix resource. Changing this forces a new resource to be created." + default = null +} + +variable "reverse_fqdn" { + type = string + description = "(Optional) A fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN." + default = null +} + +variable "sku" { + type = string + description = "(Optional) The SKU of the Public IP. Accepted values are Basic and Standard. Defaults to Standard. Changing this forces a new resource to be created." + default = "Standard" +} + +variable "sku_tier" { + type = string + description = "(Optional) The SKU Tier that should be used for the Public IP. Possible values are Regional and Global. Defaults to Regional. Changing this forces a new resource to be created." + default = "Regional" +} + +variable "tags" { + type = map(string) + description = "(Optional) A mapping of tags to assign to the resource." + default = {} +}