Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vm code #1

Merged
merged 5 commits into from
Jun 9, 2024
Merged

Vm code #1

merged 5 commits into from
Jun 9, 2024

Conversation

adityajoshi12
Copy link
Owner

Terraform code for VM Creation in Azure

Copy link

github-actions bot commented Jun 9, 2024

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Validation 🤖success

Terraform Plan 📖success

Show Plan

terraform
azurerm_resource_group.my-rg: Refreshing state... [id=/subscriptions/1efe6241-24d7-46cf-9b87-734264a63554/resourceGroups/myrg]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  - destroy

Terraform will perform the following actions:

  # azurerm_resource_group.my-rg will be destroyed
  # (because azurerm_resource_group.my-rg is not in configuration)
  - resource "azurerm_resource_group" "my-rg" {
      - id       = "/subscriptions/1efe6241-24d7-46cf-9b87-734264a63554/resourceGroups/myrg" -> null
      - location = "westus" -> null
      - name     = "myrg" -> null
      - tags     = {
          - "env" = "dev"
        } -> null
    }

  # module.vm.azurerm_linux_virtual_machine.vm[0] will be created
  + resource "azurerm_linux_virtual_machine" "vm" {
      + admin_password                  = (sensitive value)
      + admin_username                  = "azureadmin"
      + allow_extension_operations      = true
      + computer_name                   = "test-linux-vm"
      + disable_password_authentication = false
      + extensions_time_budget          = "PT1H30M"
      + id                              = (known after apply)
      + location                        = "westus"
      + max_bid_price                   = -1
      + name                            = "test-linux-vm-1"
      + network_interface_ids           = (known after apply)
      + patch_mode                      = "ImageDefault"
      + platform_fault_domain           = -1
      + priority                        = "Regular"
      + private_ip_address              = (known after apply)
      + private_ip_addresses            = (known after apply)
      + provision_vm_agent              = true
      + public_ip_address               = (known after apply)
      + public_ip_addresses             = (known after apply)
      + resource_group_name             = "rg-test"
      + size                            = "Standard_DS1_v2"
      + virtual_machine_id              = (known after apply)

      + os_disk {
          + caching                   = "ReadWrite"
          + disk_size_gb              = 100
          + name                      = (known after apply)
          + storage_account_type      = "Standard_LRS"
          + write_accelerator_enabled = false
        }

      + source_image_reference {
          + offer     = "UbuntuServer"
          + publisher = "Canonical"
          + sku       = "18.04-LTS"
          + version   = "Latest"
        }
    }

  # module.vm.azurerm_network_interface.nic[0] will be created
  + resource "azurerm_network_interface" "nic" {
      + applied_dns_servers           = (known after apply)
      + dns_servers                   = (known after apply)
      + enable_accelerated_networking = false
      + enable_ip_forwarding          = false
      + id                            = (known after apply)
      + internal_dns_name_label       = (known after apply)
      + internal_domain_name_suffix   = (known after apply)
      + location                      = "westus"
      + mac_address                   = (known after apply)
      + name                          = "test-nic-1"
      + private_ip_address            = (known after apply)
      + private_ip_addresses          = (known after apply)
      + resource_group_name           = "rg-test"
      + virtual_machine_id            = (known after apply)

      + ip_configuration {
          + gateway_load_balancer_frontend_ip_configuration_id = (known after apply)
          + name                                               = "ipconfig-1"
          + primary                                            = (known after apply)
          + private_ip_address                                 = (known after apply)
          + private_ip_address_allocation                      = "Dynamic"
          + private_ip_address_version                         = "IPv4"
          + public_ip_address_id                               = (known after apply)
          + subnet_id                                          = (known after apply)
        }
    }

  # module.vm.azurerm_network_security_group.ssh_rule will be created
  + resource "azurerm_network_security_group" "ssh_rule" {
      + id                  = (known after apply)
      + location            = "westus"
      + name                = "test-nsg"
      + resource_group_name = "rg-test"
      + security_rule       = [
          + {
              + access                                     = "Allow"
              + description                                = ""
              + destination_address_prefix                 = "*"
              + destination_address_prefixes               = []
              + destination_application_security_group_ids = []
              + destination_port_range                     = "22"
              + destination_port_ranges                    = []
              + direction                                  = "Inbound"
              + name                                       = "SSH"
              + priority                                   = 1001
              + protocol                                   = "Tcp"
              + source_address_prefix                      = "*"
              + source_address_prefixes                    = []
              + source_application_security_group_ids      = []
              + source_port_range                          = "*"
              + source_port_ranges                         = []
            },
          + {
              + access                                     = "Allow"
              + description                                = ""
              + destination_address_prefix                 = "*"
              + destination_address_prefixes               = []
              + destination_application_security_group_ids = []
              + destination_port_range                     = "80"
              + destination_port_ranges                    = []
              + direction                                  = "Inbound"
              + name                                       = "HTTP"
              + priority                                   = 1002
              + protocol                                   = "Tcp"
              + source_address_prefix                      = "*"
              + source_address_prefixes                    = []
              + source_application_security_group_ids      = []
              + source_port_range                          = "*"
              + source_port_ranges                         = []
            },
        ]
    }

  # module.vm.azurerm_public_ip.pip[0] will be created
  + resource "azurerm_public_ip" "pip" {
      + allocation_method       = "Dynamic"
      + fqdn                    = (known after apply)
      + id                      = (known after apply)
      + idle_timeout_in_minutes = 4
      + ip_address              = (known after apply)
      + ip_version              = "IPv4"
      + location                = "westus"
      + name                    = "test-public-ip-1"
      + resource_group_name     = "rg-test"
      + sku                     = "Basic"
      + sku_tier                = "Regional"
    }

  # module.vm.azurerm_resource_group.rg will be created
  + resource "azurerm_resource_group" "rg" {
      + id       = (known after apply)
      + location = "westus"
      + name     = "rg-test"
    }

  # module.vm.azurerm_subnet.subnet will be created
  + resource "azurerm_subnet" "subnet" {
      + address_prefixes                               = [
          + "10.0.1.0/24",
        ]
      + enforce_private_link_endpoint_network_policies = false
      + enforce_private_link_service_network_policies  = false
      + id                                             = (known after apply)
      + name                                           = "test-subnet"
      + resource_group_name                            = "rg-test"
      + virtual_network_name                           = "test-virtual-network"
    }

  # module.vm.azurerm_virtual_network.vnet will be created
  + resource "azurerm_virtual_network" "vnet" {
      + address_space       = [
          + "10.0.0.0/16",
        ]
      + dns_servers         = (known after apply)
      + guid                = (known after apply)
      + id                  = (known after apply)
      + location            = "westus"
      + name                = "test-virtual-network"
      + resource_group_name = "rg-test"
      + subnet              = (known after apply)
    }

Plan: 7 to add, 0 to change, 1 to destroy.

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

*Pushed by: @adityajoshi12, Action: `pull_request`*

@adityajoshi12 adityajoshi12 merged commit 22f3fa1 into main Jun 9, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant