Skip to content

Commit

Permalink
Adding public ip for Application gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
rajivreddy committed May 16, 2023
1 parent abe5881 commit 65e892f
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 4 deletions.
34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,47 @@

## Providers

No providers.
| Name | Version |
|------|---------|
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | >= 3.0.0 |

## Modules

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 |
|------|-------------|------|---------|:--------:|
| <a name="input_allocation_method"></a> [allocation\_method](#input\_allocation\_method) | Required) Defines the allocation method for this IP address. Possible values are Static or Dynamic. | `string` | `"Static"` | no |
| <a name="input_create_app_gateway"></a> [create\_app\_gateway](#input\_create\_app\_gateway) | description | `bool` | `true` | no |
| <a name="input_ddos_protection_mode"></a> [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 |
| <a name="input_ddos_protection_plan_id"></a> [ddos\_protection\_plan\_id](#input\_ddos\_protection\_plan\_id) | (Optional) The ID of DDoS protection plan associated with the public IP. | `string` | `null` | no |
| <a name="input_domain_name_label"></a> [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 |
| <a name="input_edge_zone"></a> [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 |
| <a name="input_idle_timeout_in_minutes"></a> [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 |
| <a name="input_ip_tags"></a> [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 |
| <a name="input_ip_version"></a> [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 |
| <a name="input_location"></a> [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 |
| <a name="input_pip_name"></a> [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 |
| <a name="input_public_ip_prefix_id"></a> [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 |
| <a name="input_resource_group_name"></a> [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 |
| <a name="input_reverse_fqdn"></a> [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 |
| <a name="input_sku"></a> [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 |
| <a name="input_sku_tier"></a> [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 |
| <a name="input_tags"></a> [tags](#input\_tags) | (Optional) A mapping of tags to assign to the resource. | `map(string)` | `{}` | no |
| <a name="input_zones"></a> [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 |
|------|-------------|
| <a name="output_ip_address"></a> [ip\_address](#output\_ip\_address) | The IP address value that was allocated. |
| <a name="output_pip_id"></a> [pip\_id](#output\_pip\_id) | The ID of this Public IP. |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
27 changes: 27 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -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
} */
9 changes: 9 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -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, "")
}
104 changes: 104 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -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 = {}
}

0 comments on commit 65e892f

Please sign in to comment.