provider "azurerm" {
    features {}
 
    resource_provider_registrations = "none"
}
 
resource "azurerm_resource_group" "test" {
  name     = "terraform-learning-rg-2"
  location = "centralIndia"
}
 
resource "azurerm_virtual_network" "vnet" {
    name= "test-vnet"
    location = azurerm_resource_group.test.location
    resource_group_name= azurerm_resource_group.test.name
    address_space = ["10.0.0.0/16"]
 
}
 
resource "azurerm_subnet" "subnet1" {
  name                 = "internal"
  resource_group_name  = azurerm_resource_group.test.name
  virtual_network_name = azurerm_virtual_network.vnet.name
  address_prefixes     = ["10.0.1.0/24"]
}
 
resource "azurerm_public_ip" "publicip" {
    name = "publicip"
    location= azurerm_resource_group.test.location
    resource_group_name= azurerm_resource_group.test.name
 
    allocation_method = "Static"
    sku = "Basic"
}
 
resource "azurerm_network_interface" "nic" {
  name                = "terraform-nic"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name
 
  ip_configuration {
    name                          = "internal"
    subnet_id                     = azurerm_subnet.subnet1.id
    private_ip_address_allocation = "Dynamic"
    public_ip_address_id          = azurerm_public_ip.publicip.id
  }
}