Skip to content

Commit

Permalink
Merge pull request #424 from Azure/101-virtual-network-public-ip
Browse files Browse the repository at this point in the history
101-virtual-network-public-ip
  • Loading branch information
TomArcherMsft authored Feb 18, 2025
2 parents 830634a + b2c18d3 commit fe53fb9
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 0 deletions.
71 changes: 71 additions & 0 deletions quickstart/101-virtual-network-public-ip/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
resource "random_pet" "rg_name" {
prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "example" {
location = var.resource_group_location
name = random_pet.rg_name.id
}

resource "azurerm_public_ip" "myStandardPublicIP" {
name = "myStandardPublicIP"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
allocation_method = "Static"
sku = "Standard"
ip_version = "IPv4"
zones = ["1", "2", "3"]
}

resource "azurerm_public_ip" "myBasicPublicIP" {
name = "myBasicPublicIP"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
allocation_method = "Static"
sku = "Basic"
ip_version = "IPv4"
}

resource "azurerm_public_ip" "myZonalStandardPublicIP" {
name = "myZonalStandardPublicIP"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
allocation_method = "Static"
sku = "Standard"
ip_version = "IPv4"
zones = ["2"]
}

resource "azurerm_public_ip" "myNonZonalStandardPublicIP" {
name = "myNonZonalStandardPublicIP"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
allocation_method = "Static"
sku = "Standard"
ip_version = "IPv4"
}

resource "azurerm_public_ip" "myRoutingPreferenceStandardPublicIP" {
name = "myRoutingPreferenceStandardPublicIP"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
allocation_method = "Static"
sku = "Standard"
ip_version = "IPv4"

ip_tags = {
RoutingPreference = "Internet"
}

zones = ["1", "2", "3"]
}

resource "azurerm_public_ip" "myGlobalTierStandardPublicIP" {
name = "myGlobalTierStandardPublicIP-Global"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
allocation_method = "Static"
sku = "Standard"
sku_tier = "Global"
ip_version = "IPv4"
}
3 changes: 3 additions & 0 deletions quickstart/101-virtual-network-public-ip/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "resource_group_name" {
value = azurerm_resource_group.example.name
}
16 changes: 16 additions & 0 deletions quickstart/101-virtual-network-public-ip/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}

provider "azurerm" {
features {}
}
16 changes: 16 additions & 0 deletions quickstart/101-virtual-network-public-ip/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Azure Public IP Address

This template deploys several Azure public IP addresses with different settings.

## Terraform resource types

- [random_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet)
- [azurerm_resource_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group)
- [azurerm_public_ip](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip)

## Variables

| Name | Description | Default |
|-|-|-|
| `resource_group_name_prefix` | Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription. | rg |
| `resource_group_location` | Location of the resource group. | eastus |
11 changes: 11 additions & 0 deletions quickstart/101-virtual-network-public-ip/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
variable "resource_group_location" {
type = string
default = "West Europe"
description = "Location of the resource group."
}

variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
}

0 comments on commit fe53fb9

Please sign in to comment.