{"id":19446274,"url":"https://github.com/devskiller/infra-dsl","last_synced_at":"2025-04-25T01:32:05.428Z","repository":{"id":57718764,"uuid":"118918627","full_name":"Devskiller/infra-dsl","owner":"Devskiller","description":"Groovy DSL for Infrastructure","archived":false,"fork":false,"pushed_at":"2018-07-26T10:32:44.000Z","size":555,"stargazers_count":13,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T14:43:34.018Z","etag":null,"topics":["infrastructure","infrastructure-as-code","infrastructure-management","orchestration","terraform"],"latest_commit_sha":null,"homepage":null,"language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Devskiller.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-25T13:51:28.000Z","updated_at":"2020-06-08T16:36:56.000Z","dependencies_parsed_at":"2022-09-26T21:40:28.070Z","dependency_job_id":null,"html_url":"https://github.com/Devskiller/infra-dsl","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devskiller%2Finfra-dsl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devskiller%2Finfra-dsl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devskiller%2Finfra-dsl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devskiller%2Finfra-dsl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Devskiller","download_url":"https://codeload.github.com/Devskiller/infra-dsl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250738133,"owners_count":21479138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["infrastructure","infrastructure-as-code","infrastructure-management","orchestration","terraform"],"created_at":"2024-11-10T16:13:23.429Z","updated_at":"2025-04-25T01:32:05.097Z","avatar_url":"https://github.com/Devskiller.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InfraDSL\n\nGroovy DSL for Terraform. Clean and easy way to define infrastructure in code.\n\n## More description soon. Enjoy the sample below :) \n\n```bash\njava -jar infra-dsl-VERSION.jar path_to_your_file.groovy\n```\n\n```groovy\nInfrastructure.resourceGroup('sample') {\n\n\tregion 'westeurope'\n\n\tnetwork {\n\t\tnetworkId 1\n\t\tsubnets {\n\t\t\tsubnet('app') {\n\t\t\t\tsubnetId 1\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponents {\n\t\tcomponent('vpn') {\n\t\t\tavailabilitySet {}\n\t\t\tnetworkSecurityGroup {\n\t\t\t\tdefaultsSecurityRules(delegate)\n\t\t\t\tsecurityRule {\n\t\t\t\t\tname 'ssh'\n\t\t\t\t\tdestinationPort 22\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (i in 1..2) {\n\t\t\t\tvirtualMachine(i) {\n\t\t\t\t\tnetworkInterface {\n\t\t\t\t\t\tsubnetName 'app'\n\t\t\t\t\t}\n\t\t\t\t\tinstance {\n\t\t\t\t\t\tsize 'Standard_A0'\n\t\t\t\t\t\tcentOsImage(delegate)\n\t\t\t\t\t\tosProfile {\n\t\t\t\t\t\t\tadminUsername 'root'\n\t\t\t\t\t\t\tadminPassword 'password'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}\n\nstatic void defaultsSecurityRules(NetworkSecurityGroup nsg) {\n\tnsg.with {\n\t\tsecurityRule {\n\t\t\tname 'www'\n\t\t\tdestinationPort 80\n\t\t}\n\t}\n}\n\nstatic void centOsImage(VirtualMachine virtualMachine) {\n\tvirtualMachine.with {\n\t\timage {\n\t\t\tpublisher 'OpenLogic'\n\t\t\toffer 'CentOS'\n\t\t\tsku '7.3'\n\t\t}\n\t}\n}\n```\n\nproduces such Terraform definition:\n```\nprovider \"azurerm\" {\n}\n\nresource \"azurerm_resource_group\" \"sample-weu-rg\" {\n  name                            = \"sample-weu-rg\"\n  location                        = \"westeurope\"\n\n  tags {\n    env                           = \"sample\"\n  }\n}\n\n\nresource \"azurerm_virtual_network\" \"sample-weu-vnet\" {\n  name                            = \"sample-weu-vnet\"\n  resource_group_name             = \"sample-weu-rg\"\n  location                        = \"westeurope\"\n  address_space                   = [\"10.1.0.0/16\"]\n\n  tags {\n    env                           = \"sample\"\n  }\n}\n\nresource \"azurerm_subnet\" \"sample-weu-subnet-app\" {\n  name                            = \"sample-weu-subnet-app\"\n  resource_group_name             = \"sample-weu-rg\"\n  address_prefix                  = \"10.1.1.0/24\"\n  virtual_network_name            = \"sample-weu-vnet\"\n}\nnull\n\nresource \"azurerm_availability_set\" \"sample-weu-as-vpn\" {\n  name                            = \"sample-weu-as-vpn\"\n  resource_group_name             = \"sample-weu-rg\"\n  location                        = \"westeurope\"\n  platform_update_domain_count    = \"5\"\n  platform_fault_domain_count     = \"3\"\n  managed                         = \"true\"\n\n  tags {\n    env                           = \"sample\"\n    component                     = \"vpn\"\n  }\n}\n\nresource \"azurerm_network_security_group\" \"sample-weu-nsg-vpn\" {\n  name                            = \"sample-weu-nsg-vpn\"\n  resource_group_name             = \"sample-weu-rg\"\n  location                        = \"westeurope\"\n\n  security_rule {\n    name                          = \"www\"\n    access                        = \"Allow\"\n    protocol                      = \"*\"\n    source_port_range             = \"*\"\n    destination_port_range        = \"80\"\n    source_address_prefix         = \"*\"\n    destination_address_prefix    = \"*\"\n    priority                      = \"200\"\n    direction                     = \"Inbound\"\n  }\n\n  security_rule {\n    name                          = \"ssh\"\n    access                        = \"Allow\"\n    protocol                      = \"*\"\n    source_port_range             = \"*\"\n    destination_port_range        = \"22\"\n    source_address_prefix         = \"*\"\n    destination_address_prefix    = \"*\"\n    priority                      = \"201\"\n    direction                     = \"Inbound\"\n  }\n\n  tags {\n    env                           = \"sample\"\n    component                     = \"vpn\"\n  }\n}\n\nresource \"azurerm_network_interface\" \"sample-weu-ni-vpn-1\" {\n  name                            = \"sample-weu-ni-vpn-1\"\n  resource_group_name             = \"sample-weu-rg\"\n  location                        = \"westeurope\"\n  enable_accelerated_networking   = \"false\"\n  network_security_group_id       = \"${azurerm_network_security_group.sample-weu-nsg-vpn.id}\"\n\n  ip_configuration {\n    name                          = \"sample-weu-nipc-vpn\"\n    subnet_id                     = \"${azurerm_subnet.sample-weu-subnet-app.id}\"\n    private_ip_address_allocation = \"Dynamic\"\n  }\n\n  tags {\n    env                           = \"sample\"\n    component                     = \"vpn\"\n  }\n}\n\nresource \"azurerm_virtual_machine\" \"s-weu-vpn1\" {\n  name                            = \"s-weu-vpn1\"\n  resource_group_name             = \"sample-weu-rg\"\n  location                        = \"westeurope\"\n  network_interface_ids           = [\"${azurerm_network_interface.sample-weu-ni-vpn-1.id}\"]\n  primary_network_interface_id    = \"${azurerm_network_interface.sample-weu-ni-vpn-1.id}\"\n  vm_size                         = \"Standard_A0\"\n  availability_set_id             = \"${azurerm_availability_set.sample-weu-as-vpn.id}\"\n\n  storage_os_disk {\n    name                          = \"sample-weu-disk-vpn-1-os\"\n    create_option                 = \"FromImage\"\n  }\n\n  storage_image_reference {\n    publisher                     = \"OpenLogic\"\n    offer                         = \"CentOS\"\n    sku                           = \"7.3\"\n    version                       = \"latest\"\n  }\n\n  os_profile {\n    computer_name                 = \"s-weu-vpn1\"\n    admin_username                = \"root\"\n    admin_password                = \"password\"\n  }\n\n  os_profile_linux_config {\n    disable_password_authentication = \"false\"\n  }\n\n  tags {\n    env                           = \"sample\"\n    component                     = \"vpn\"\n  }\n}\n\nresource \"azurerm_network_interface\" \"sample-weu-ni-vpn-2\" {\n  name                            = \"sample-weu-ni-vpn-2\"\n  resource_group_name             = \"sample-weu-rg\"\n  location                        = \"westeurope\"\n  enable_accelerated_networking   = \"false\"\n  network_security_group_id       = \"${azurerm_network_security_group.sample-weu-nsg-vpn.id}\"\n\n  ip_configuration {\n    name                          = \"sample-weu-nipc-vpn\"\n    subnet_id                     = \"${azurerm_subnet.sample-weu-subnet-app.id}\"\n    private_ip_address_allocation = \"Dynamic\"\n  }\n\n  tags {\n    env                           = \"sample\"\n    component                     = \"vpn\"\n  }\n}\n\nresource \"azurerm_virtual_machine\" \"s-weu-vpn2\" {\n  name                            = \"s-weu-vpn2\"\n  resource_group_name             = \"sample-weu-rg\"\n  location                        = \"westeurope\"\n  network_interface_ids           = [\"${azurerm_network_interface.sample-weu-ni-vpn-2.id}\"]\n  primary_network_interface_id    = \"${azurerm_network_interface.sample-weu-ni-vpn-2.id}\"\n  vm_size                         = \"Standard_A0\"\n  availability_set_id             = \"${azurerm_availability_set.sample-weu-as-vpn.id}\"\n\n  storage_os_disk {\n    name                          = \"sample-weu-disk-vpn-2-os\"\n    create_option                 = \"FromImage\"\n  }\n\n  storage_image_reference {\n    publisher                     = \"OpenLogic\"\n    offer                         = \"CentOS\"\n    sku                           = \"7.3\"\n    version                       = \"latest\"\n  }\n\n  os_profile {\n    computer_name                 = \"s-weu-vpn2\"\n    admin_username                = \"root\"\n    admin_password                = \"password\"\n  }\n\n  os_profile_linux_config {\n    disable_password_authentication = \"false\"\n  }\n\n  tags {\n    env                           = \"sample\"\n    component                     = \"vpn\"\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevskiller%2Finfra-dsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevskiller%2Finfra-dsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevskiller%2Finfra-dsl/lists"}