Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Infrastructure as Code and AI - does it fit? (D...

Infrastructure as Code and AI - does it fit? (DevOpsCon Berlin 2024)

AI combined with cloud computing and Infrastructure as Code - does it fit? Yes, indeed! Are you curious how GitHub Copilot could support you in implementing Infrastructure as Code to deploy resources on Azure in an automated manner? This talk reveals my approach to using the AI pair programming tool. Starting from scratch, I will create a working Terraform configuration that can deploy a Kubernetes cluster on Azure, by just providing comments. What do good practices for that look like? I'll prove that AI speeds up your development speed and works well for Infrastructure as Code approaches.

Patrick Koch

June 23, 2024
Tweet

More Decks by Patrick Koch

Other Decks in Programming

Transcript

  1. Patrick Koch Email: [email protected] Blog: patrickkoch.dev LinkedIn: patkoch87 GitHub: patkoch

    Twitter/X: PK_Koch Mastodon: @[email protected] Cloud Adoption Engineer, AVL List GmbH Source icons: Microsoft, HashiCorp
  2. Content What is Infrastructure as Code? Usages of AI tools

    for Infrastructure as Code Demo(s) for the usages Are my prompts retained? Conclusion
  3. What is Infrastructure as Code?  Infrastructure as Code (IaC)

    is a method of managing and provisioning computing infrastructure through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools. It's a key practice in DevOps and is used in conjunction with continuous delivery.  IaC allows developers to automate the process of setting up and managing infrastructure, which can lead to faster deployment times, more efficient use of resources, and more reliable and repeatable processes. It can be used to manage a wide range of services, including networks, virtual machines, load balancers, and connection topology. Source: GitHub Copilot
  4. Example: Azure Kubernetes Cluster resource "azurerm_resource_group" "example" { name =

    „gaa-24-rg" location = "West Europe" } resource "azurerm_kubernetes_cluster" "example" { name = „gaa-24-aks" location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name dns_prefix = "exampleaks1" default_node_pool { name = "default" node_count = 1 vm_size = "Standard_D2_v2" } identity { type = "SystemAssigned" } tags = { Environment = "Production" } } Azure AKS Azure Icons: Azure Public Service Icons V14, Terraform Icon: HashiCorp Brand Kit
  5. Code Generation Code Interpretation Trouble Shooting Security Answering questions Giving

    advice Icon MS Copilot: Microsoft 365 Copilot Icon.svg - Wikimedia Commons Icon Gemini: https://en.m.wikipedia.org/wiki/File:Google_Gemini_logo.svg Icon GitHub Copilot: Microsoft (provided by Maxim Salnikov)
  6. resource "azurerm_network_security_group" "sg-rdp- connection" { name = "gaa24demonsg" location =

    azurerm_resource_group.rg.location resource_group_name = azurerm_resource_group.rg.name security_rule { name = "tcptraffic" priority = 100 direction = "Inbound" access = "Allow" protocol = "Tcp" source_port_range = "*" destination_port_range = "*" source_address_prefix = "*" destination_address_prefix = "*" } tags = { environment = "Testing" } }
  7. param registryName string param location string = resourceGroup().location param sku

    string = 'Basic' resource acr 'Microsoft.ContainerRegistry/registries@2021-06-01-preview' = { name: registryName location: location sku: { name: sku } properties: { adminUserEnabled: true } }