Wandarnem
Средний
14 мин
1.6K
Блог компании Яндекс Практикум Системное администрирование *Программирование *DevOps *
Кейс

Есть такие ребята — SRE (с англ. Site Reliability Engineering), которые выросли из старых добрых и бородатых системных администраторов. Но они устали заниматься ежедневной рутиной и решили всё автоматизировать. Именно поэтому 50% времени SRE пишут код.

Не спешите применять это правило ко всем знакомым SRE, потому что в основном они поддерживают инфраструктуру проекта: запускают серверы, мониторят Kubernetes и перекладывают JSON из одного сервиса в другой. Решение всех этих задач они стремятся оформить в виде кода: скриптов, утилит, пайплайнов и манифестов.
А ведь со временем кода станет очень много, и его придётся читать, тестировать, рефакторить. Можно переписать внутреннее устройство функции, но для пользователя функции её поведение не изменится. Зато читабельность и производительность кода возрастут!
Рефакторить — перерабатывать архитектуру кода так, чтобы это было незаметно внешним пользователям.
У ребят из команды SRE основной объём кода будет инфраструктурным, то есть манифесты описания инфраструктуры. И стандарт де-факто для такого описания сегодня — это Terraform. Жизненный цикл сопровождения такого Tеrraform-кода зависит от проекта, и тут нет «волшебной пилюли» и строгих правил.
Разберём один из примеров организации IaaC-репозитория (Infrastructure as a Code) для Terraform и начнём с вредных советов.
Ничто не предвещало беды
На старте проекта вы создаёте свою первую виртуальную машину в Terraform-манифесте с помощью соответствующего ресурса.
Ресурсом в Terraform называется блок, описывающий инфраструктурный объект в облаке: виртуальная машина, сеть или DNS-запись.
Здесь и далее в качестве примера будем использовать Terraform-провайдер для Yandex Cloud.
Сделайте так, чтобы в файле-манифесте compute.tf
у вас появилось описание:
compute.tf
resource "yandex_compute_instance" "default" { name = "test" platform_id = "standard-v1" zone = "ru-central1-a" resources { cores = 2 memory = 4 } boot_disk { initialize_params { image_id = "image_id" } } network_interface { subnet_id = "${yandex_vpc_subnet.foo.id}" } metadata = { foo = "bar" ssh-keys = "ubuntu:${file("~/.ssh/id_rsa.pub")}" }}
Хотя нет. Сначала нужно создать VPC и подсеть: разместим эти ресурсы в файле network.tf
.
network.tf
resource "yandex_vpc_network" "foo" {}resource "yandex_vpc_subnet" "foo" { zone = "ru-central1-a" network_id = "${yandex_vpc_network.foo.id}" v4_cidr_blocks = ["10.5.0.0/24"]}
Теперь нам нужно запустить Kubernetes-кластер в облаке, поэтому создадим файл k8s.tf
:
k8s.tf
resource "yandex_kubernetes_cluster" "my_cluster" { name = "name" description = "description" network_id = "${yandex_vpc_network.network_resource_name.id}" master { version = "1.17" zonal { zone = "${yandex_vpc_subnet.foo.zone}" subnet_id = "${yandex_vpc_subnet.foo.id}" } public_ip = true security_group_ids = ["${yandex_vpc_security_group.security_group_name.id}"] maintenance_policy { auto_upgrade = true maintenance_window { start_time = "15:00" duration = "3h" } } master_logging { enabled = true log_group_id = "${yandex_logging_group.log_group_resoruce_name.id}" kube_apiserver_enabled = true cluster_autoscaler_enabled = true events_enabled = true } } service_account_id = "${yandex_iam_service_account.service_account_resource_name.id}" node_service_account_id = "${yandex_iam_service_account.node_service_account_resource_name.id}" labels = { my_key = "my_value" my_other_key = "my_other_value" } release_channel = "RAPID" network_policy_provider = "CALICO" kms_provider { key_id = "${yandex_kms_symmetric_key.kms_key_resource_name.id}" }}
И сюда же добавим описание нод-кластера. Или давайте добавим ноды в отдельный файл k8s-nodes.tf
, ведь бывает много отдельных групп, которые нужно быстро найти:
k8s-nodes.tf
resource "yandex_kubernetes_node_group" "my_node_group" { cluster_id = "${yandex_kubernetes_cluster.my_cluster.id}" name = "name" description = "description" version = "1.22" labels = { "key" = "value" } instance_template { platform_id = "standard-v2" network_interface { nat = true subnet_ids = ["${yandex_vpc_subnet.foo.id}"] } resources { memory = 2 cores = 2 } boot_disk { type = "network-hdd" size = 64 } scheduling_policy { preemptible = false } container_runtime { type = "containerd" } } scale_policy { fixed_scale { size = 1 } } allocation_policy { location { zone = "ru-central1-a" } } maintenance_policy { auto_upgrade = true auto_repair = true maintenance_window { day = "monday" start_time = "15:00" duration = "3h" } maintenance_window { day = "friday" start_time = "10:00" duration = "4h30m" } }}
Но виртуальных машин у нас может быть много, да и кластеров K8s тоже. Поэтому разделим их не по типу ресурса, а по проектам. Так проще сопровождать конкретный проект. Создадим файл project1.tf
.
Зависимости
Ресурсы в манифестах обязательно зависят друг от друга — идентификаторы одних ресурсов будут использоваться в описании других.
Например, чтобы быстро находить серверы при настройке сетевых доступов между ними, создадим файл для групп безопасности (security groups) — sg.tf
.
Виртуальным машинам нужен доступ в Kubernetes, а сервисам в Kubernetes — к виртуальным машинам. А ещё некоторые виртуальные машины «ровнее других», и им нужен доступ к сервисам в другом проекте (но не наоборот).
В одном проекте такие зависимости легко реализуются. Можно сослаться на идентификатор ресурса в соответствующих правилах:
resource "yandex_vpc_security_group" "group1" { name = "My security group 1" description = "description for my security group" network_id = yandex_vpc_network.foo.id # Разрешаем исходящий трафик к хостам group2 egress { protocol = "UDP" description = "rule3 description" security_group_id = yandex_vpc_security_group.group2.id port = 8080 }}resource "yandex_vpc_security_group" "group2" { name = "My security group 2" description = "description for my security group" network_id = yandex_vpc_network.foo.id # Разрешаем входящий трафик от хостам group1 ingress { protocol = "TCP" description = "rule1 description" security_group_id = yandex_vpc_security_group.group1.id port = 8080 }}
Но подождите, у нас тут циклическая зависимость двух ресурсов. Давайте для каждого сервиса будем создавать по две группы безопасности. Одну сделаем пустой и будем указывать её в правилах других групп безопасности, а вторая поработает в правилах:
# Пустая группа для хостов group1resource "yandex_vpc_security_group" "group1-initial" { name = "My initial security group 1" description = "description for my security group" network_id = yandex_vpc_network.foo.id}resource "yandex_vpc_security_group" "group1" { name = "My security group 1" description = "description for my security group" network_id = yandex_vpc_network.foo.id# Чтобы избежать циклических зависимостей, указываем пустую group2-initial egress { protocol = "UDP" description = "rule3 description" security_group_id = yandex_vpc_security_group.group2-initial.id port = 8080 }}resource "yandex_vpc_security_group" "group2-initial" { name = "My security group 2" description = "description for my security group" network_id = yandex_vpc_network.foo.id}resource "yandex_vpc_security_group" "group2" { name = "My security group 2" description = "description for my security group" network_id = yandex_vpc_network.foo.id ingress { protocol = "TCP" description = "rule1 description" security_group_id = yandex_vpc_security_group.group1-initial.id port = 8080 }}
Запутанно, тут у нас зарождается начало первой макаронины, но зато это решает нашу проблему с циклом. А все зависимости между сервисами можно держать в голове: когда джун придёт за помощью, вы быстро укажете строчку в манифесте, чтобы вставить нужное правило.
Некоторое время спустя
Репозиторий разрастается, к одному способу организации добавляется второй, а потом третий, и мы получаем вот такой набор файлов.
Содержимое репозитория
.├── project1.tf├── project1-xyz.tf├── project1-db-master.tf├── project1-s3-project2-copy1.tf├── project1-s3-project3-copy1.tf├── project1-s3-project3.tf├── project1-s3-project4.tf├── project1-subnets.tf├── project1-secrets.tf├── project-6.tf├── project2-test.tf├── project2-test2.tf├── project2-integrations.tf├── project2-from-company.tf├── project2-dev.tf├── project2-ci.tf├── project2-to-company-sg.tf├── project2-to-company.tf├── jump-host.tf├── monitoring.tf├── cdn-internal.tf├── cdn-external.tf├── cicd.tf├── siem-dev-compute.tf├── cloud-init│ ├── de-keys│ ├── de-devops-keys│ ├── de-admin-keys│ ├── de-whoami-keys│ ├── devops-keys│ ├── ipv4-router.yaml│ ├── ipv6-router.yaml│ ├── scripts.yaml│ ├── k8s-keys│ ├── super-super-users.yaml│ └── super-users.yaml├── cloud.tf├── cloud_company_test.tf├── compute-non-production.tf├── compute.tf├── control.tf├── servers.tf├── dev-project1-integrations-kafka-topics.tf├── dev-project1-integrations-kafka.tf├── dev-project1-integrations.tf├── dev-project1-db.tf├── my-vm.tf├── dns-microservices.tf├── dns-macroservices.tf├── inokentiy.tf├── accounting-1c.tf├── accounting-1c-enterprise.tf├── accounting-backups.tf├── accounting-db.tf├── accounting-analytics.tf├── accounting-project8-s3.tf├── accounting-containers.tf├── accounting-s3.tf├── accounting-subnets.tf├── accounting.tf├── express-all.tf├── security-rules-s3.tf├── security-rules.tf├── ci-project1-sec.tf├── ci-ansible.tf├── ci-autotests.tf├── ci-common.tf├── ci-deploy.tf├── ci-accounting.tf├── ci-infra.tf├── ci-here.tf├── ci-project8.tf├── ci-build.tf├── ci-tf.tf├── cicd2.tf├── mons.tf├── iam.tf├── proxy-nonsecure.tf├── proxy-secure.tf├── ipsec.tf├── k8s-sib.tf├── k8s-common.tf├── k8s-dev-common-nodes.tf├── k8s-dev-ingress.tf├── k8s-dev-nodes.tf├── k8s-dev-sa.tf├── k8s-dev-vm-nodes.tf├── k8s-dev.tf├── k8s-secure-dev-common-nodes.tf├── k8s-secure-dev-ingress.tf├── k8s-secure-dev-nodes.tf├── k8s-secure-dev-vm-nodes.tf├── k8s-secure-dev.tf├── k8s-test-common-nodes.tf├── k8s-test-ingress.tf├── k8s-test-nodes.tf├── k8s-test-secure-common-nodes.tf├── k8s-test-secure-ingress.tf├── k8s-test-secure-nodes.tf├── k8s-test-secure-sql-nodes.tf├── k8s-test-secure-vm-nodes.tf├── k8s-test-secure.tf├── k8s-test-sa.tf├── k8s-test-vm-nodes.tf├── k8s-test.tf├── keys.tf├── lb.tf├── test-dev-compute.tf├── adapter.tf├── connector.tf├── db-backend-baza.tf├── db-backend.tf├── db.tf├── midnight-computer.tf├── nat.tf├── network.tf├── cache.tf├── outputs.tf├── secure-dmz.tf├── backups.tf├── project8-stand-folder.tf├── project8-stand-sg.tf├── project8-stands.tf├── project8-proxy.tf├── project8-new-left.tf├── project8-new.tf├── project8-new-vars.tf├── project8-folder.tf├── project8-some-tests.tf├── project8-lb.tf├── project8-proxy-compute.tf├── project8-proxy-sg.tf├── project8-proxy-variables.tf├── project8-smoke-compute.tf├── project8-smoke-dns.tf├── project8-smoke-db.tf├── project8-smoke-network.tf├── project8-smoke-s3.tf├── project8-smoke-sg.tf├── project8-smoke-variables.tf├── project8-test-compute.tf├── project8-test-dns.tf├── project8-test-folder.tf├── project8-test-lb.tf├── project8-test-lockbox.tf├── project8-test-db.tf├── project8-test-network.tf├── project8-test-copies.tf├── project8-test-sg.tf├── project8-test-variables.tf├── project8-testlab-compute.tf├── project8-to-internet.tf├── project8-test-folder.tf├── project8-test.tf├── proxy-to-partners.tf├── qa.tf├── containers.tf├── s3.tf├── s3_project8_project1.tf├── s3_project8_project2.tf├── external-to-project8.tf├── scripts│ ├── manage.sh│ └── unmanage.sh├── project7-test.tf├── project7.tf├── sg-for-servers.tf├── sg.tf├── sg-nikolay.tf├── work-in-progress.tf├── ver1-work-in-progress.tf├── sib-compute.tf├── sib-lb.tf├── sib-db.tf├── sib-other.tf├── sib-sg.tf├── wtf.tf├── analyze-compute.tf├── analyze-lb.tf├── analyze-db-proxy.tf├── analyze-other.tf├── analyze-sg.tf├── templates│ ├── script.yaml│ ├── open.yaml│ ├── forwarder.yaml│ ├── logs.yaml│ └── logs-forwarder.yaml├── test-project1-integrations-kafka-topics.tf├── test-project1-integrations-kafka.tf├── test-project1-integrations.tf├── test-project1-db-int.tf├── test-project1-db.tf├── test-project1-s3-exchange.tf├── test-project1-s3-project8.tf├── test-project1-s3-wtf.tf├── test-project1-subnets.tf├── test-dns-microservices.tf├── test-dns-macroservices.tf├── test-backend-kafka.tf├── test-backend-redis.tf├── test-backend-db.tf├── secrets-test-dev-compute.tf├── secrets.tf├── playground.tf├── manager.tf├── s3-share.tf└── sa.tf
Если вы хотели посмотреть на реальный проект — вот он выше.
Теперь нам нужно разделить тестовое и продовое окружения, и после долгой плодотворной дискуссии мы с командой решаем продублировать весь этот набор файлов для прода.
Если запустить terraform plan
в таком проекте, то можем ждать от 10 до 40 минут, и наш state заблокируется на всё время выполнения.
plan
показывает намерения изменений, которые Terraform собирается выполнить.
terraform state
— это хранилище состояния текущей инфраструктуры. Такое состояние сравнивается с кодом описания в манифестах и с реальным положением вещей в облаке. После такого сравнения Terraform принимает решение о выполнении изменений. Стейт хранится в файле, поэтому можете использовать различные бэкенды для централизованного размещения этого файла.
Как раз успеете распить цикорий всей командой.
Хотя, конечно, добавление очередной виртуальной машины или правила в группу безопасности займёт гораздо больше времени: понадобится раскрутить клубок зависимостей, вставить описание ресурсов в нужное место и проделать несколько итераций запуска terraform plan
для отладки изменений.
Одна и та же задача решается по-разному в разных файлах, и кажется, чтобы проделать аналогичное изменение в этот раз, проще создать новый файл и описать ресурсы заново.
Самое главное — работой вы точно будете обеспечены! Со временем и вовсе станете матёрыми экспертами: в голове кристаллизуется граф зависимостей между ресурсами, в котором вы будете хорошо ориентироваться, а у молодого и неопытного джуна появится наставник.
Вам же придётся доверять этому коду до тех пор, пока в голове «сидят» особенности работы всех зависимостей.
А что тут плохого?
Давайте выпишем список совершенных грехов:
В репозитории отсутствует хоть сколько-нибудь логичная структура — в этом наборе файлов сам чёрт ногу сломит.
Блокирование стейта снижает эффективность команды: кто-то катит очередные изменения, а вы ждёте, пока они применятся.
Неопределённые интерфейсы в зависимостях. Тут можно провести аналогию с языками динамической типизации: несоответствия типов могут всплывать слишком поздно, когда они уже нанесли вред продовой инфраструктуре.
Много «копипасты» и повторения кода.
К такому коду мало доверия: новичку сложно ответить на вопрос «Что будет, если я запущу
terraform apply
?».Как это всё запускать в CI?
А как надо?
Модули
Описание вашего проекта нужно начать с Terraform-модулей. Terraform-модуль — это набор манифестов, собранных вместе для решения определенной задачи. Модуль можно выложить в общий доступ с помощью git-репозитория, хранить локально или использовать специальный сервис Terraform Registry. Типовой модуль может иметь следующую файловую структуру:
├── main.tf├── outputs.tf├── variables.tf├── README.md
Во-первых, модули создают удобные абстракции, и вы можете описать инфраструктуру с помощью архитектурных терминов вместо использования физических объектов. Сравните:
Слева | Справа |
В этом проекте нам нужно запустить три сервера в разных зонах доступности, балансировщик и кластер баз данных | В этом проекте мы запустим сервис API-прокси для бесшовной интеграции нового бэкенда |
И какой вариант вам больше нравится?

Во-вторых, модули описывают строгие контракты для входных и выходных переменных. При использовании модулей вы соединяете выходные переменные (outputs) одного модуля c входными переменными (variables) другого модуля, а строгие контракты позволяют избежать ошибок в процессе сопровождения инфраструктуры и серьёзных инцидентов.
Например, описание сложной переменной для сетевых интерфейсов определяется её типом:
variable "network_interfaces" { description = "Instance network interfaces" # optional и значения по умолчанию появились в Terraform ≥ 1.3 type = map(object({ subnet_id = string ip_address = optional(string) security_group_ids = optional(set(string)) ipv6 = optional(bool) nat = optional(bool) nat_ip = optional(string) dns_record = optional(object({ dns_zone_id = string ttl = optional(number, 300) ptr = optional(bool, true) })) nat_dns_record = optional(object({ dns_zone_id = string ttl = optional(number, 300) ptr = optional(bool, true) })) })) default = {}}
Если на вход подать некорректный объект, например, не указав обязательное поле subnet_id
, то Terraform сообщит нам об ошибке на ранней стадии валидации кода.
В-третьих, для каждого отдельного модуля можно написать тесты.
Тесты
Тесты для инфраструктурной автоматизации обеспечивают надёжное доверие к этой самой инфраструктурной автоматизации: поведение модуля тестируют на разных входных параметрах, а при изменении кода модуля можно будет понять влияние этого изменения на инфраструктуру.
Тесты особенно полезны в сложных модулях, в которых используются динамические блоки, циклы и вычисляемые локальные переменные (locals): поведение таких модулей почти невозможно прогнозировать, только читая код.
Наиболее популярный фреймворк для тестирования модулей — это Terratest — библиотека для Go, с помощью которой можно проверить как простые test-кейсы (ожидаемый output), так и сложную интеграционную логику с другими модулями.
package testimport ("testing""github.com/gruntwork-io/terratest/modules/terraform""github.com/stretchr/testify/assert")func TestTerraformModule(t *testing.T) {terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{TerraformDir: "./tests",})// Удаляем ресурсы после тестовdefer terraform.Destroy(t, terraformOptions)// Запускаем apply для тестовых ресурсовterraform.InitAndApply(t, terraformOptions)output := terraform.Output(t, terraformOptions, "hello_world")// Проверяем - тестируем, что output соответствует ожиданиямassert.Equal(t, "Hello, World!", output)}
При тестировании Terraform-модулей будет создаваться реальная инфраструктура в облаке. Такие тесты не похожи на Unit-тестирование — возможности создать mock-объекты для облачных провайдеров пока нет. Хотя что-то можно проверить, анализируя только вывод
terraform plan
.
Разбивка кода проекта на логичную структуру
Теперь подумаем, как нам разбить весь проект на логичную структуру. В любом проекте обязательно выделяется инфраструктурный фундамент в виде VPC, подсетей и DNS-зоны. Назовём этот фундамент infra
:
.└── terraform └── infra ├── dns │ └── main.tf ├── sa └── vpc
Для каждого окружения заведём отдельную директорию:
.└── terraform ├── envs │ ├── dev │ ├── prod │ └── test └── infra ├── dns ├── sa └── vpc
Но для работы с такой структурой нам нужно зайти в каждую директорию и выполнить terraform apply
, а для обмена данными можно использовать terraform_remote_state
источника данных (data source).
Terragrunt
Конечно, в любой CI-системе это можно организовать с помощью скриптов. Для оркестрации инфраструктурного Terraform-кода в сложном проекте хорошо зарекомендовал себя инструмент-враппер Terragrunt. Как и в случае с чистым Terraform, вы разбиваете код на модули, но для вызова этих модулей и передачи им входных переменных используете конфигурационные файлы terragrunt.hcl
:
.└── terraform ├── envs │ ├── dev │ │ └── compute│ │ └── terragrunt.hcl │ │ k8s │ │ └── terragrunt.hcl │ ├── prod │ └── test └── infra ├── dns ├── sa └── vpc
При выполнении команды terragrunt run-all apply
в корневой директории проекта оркестратор пройдётся по всем вложенным директориям и применит конфигурацию модуля, описанную в terragrunt.hcl
.
Для каждого расположения конфигурации Terragrunt создаст свой собственный state-файл, например, envs/dev/compute/terraform.tfstate
в настроенном бэкенде, а для обмена данными между этими стейтами будут использоваться переменные и выходные переменные модулей.
Чтобы описать зависимости между двумя модулями, используют ключевое слово dependency
:
dependency "vpc" { config_path = "../../../infra/vpc"}inputs = { vpc_id = dependency.vpc.outputs.vpc_id}
В этом примере мы описали зависимость модуля compute
от модуля vpc
и передали входную переменную vpc_id
в модуль compute
.
Вспомним всё и подведём итоги
Давайте теперь вспомним список проблем, который мы составляли в самом начале, и что получили:
В репозитории присутствует логичная структура: модули и их использование в Terragrunt позволили разбить код на логичные структурные блоки.
Каждая небольшая часть инфраструктуры работает со своим состоянием, не блокируя работу с другими: для каждого окружения создаётся свой state-файл.
Между модулями определены интерфейсы в виде входных переменных и выходных значений.
Организация кода в виде модулей добавляет возможность переиспользования.
К коду модуля больше доверия за счёт тестов: мы можем убедиться, что модуль работает корректно.
CI теперь можно организовать довольно гибко: для каждой части инфраструктуры и для каждого окружения.
Заключение
В этой статье мы рассмотрели, как можно организовать инфраструктурный код в Terraform-проекте. Мы разбили код на модули, описали зависимости между ними и научились запускать их с помощью Terragrunt.
Теперь можно смело переходить к следующему этапу — автоматизации с помощью CI-систем. Конечная цель организации инфраструктурного кода — создание надёжной и масштабируемой инфраструктуры, которая может поддерживаться и расширяться без лишних трудностей для SRE-инженера и команды, а таких трудностей можно избежать благодаря CI-системам.
Тестирование кода с помощью Terratest также имеет решающее значение для обеспечения качества и безопасности вашей инфраструктуры. Тестирование позволяет проверить, работает ли код так, как он должен работать, и выявлять ошибки и проблемы до того, как они станут критическими. Тестирование также помогает вам убедиться, что ваша инфраструктура работает так, как вы ожидаете, и что она не будет нежелательно изменена во время разработки.
FAQs
What does infrastructure as code say? ›
Infrastructure as Code (IaC) is the managing and provisioning of infrastructure through code instead of through manual processes. With IaC, configuration files are created that contain your infrastructure specifications, which makes it easier to edit and distribute configurations.
What is an example of infrastructure as a code? ›Examples of infrastructure-as-code tools include AWS CloudFormation, Red Hat Ansible, Chef, Puppet, SaltStack and HashiCorp Terraform. Some tools rely on a domain-specific language (DSL), while others use a standard template format, such as YAML and JSON.
What is infrastructure as code for dummies? ›Infrastructure as Code or IaC is the process of provisioning and managing infrastructure defined through code, instead of doing so with a manual process. As infrastructure is defined as code, it allows users to easily edit and distribute configurations while ensuring the desired state of the infrastructure.
Is infrastructure as code worth IT? ›One of the main benefits of infrastructure as code is that it can automate repetitive tasks. Provisioning a new server using infrastructure as code to automate the process is the most straightforward example. As a result, enterprises can scale up infrastructure management without increasing operational expenditure.
What are the 4 components of IT infrastructure? ›A traditional IT infrastructure is made up of the usual hardware and software components: facilities, data centers, servers, networking hardware desktop computers and enterprise application software solutions.
What problem does IaC solve? ›IaC evolved to solve the problem of environment drift in release pipelines. Without IaC, teams must maintain deployment environment settings individually. Over time, each environment becomes a "snowflake," a unique configuration that can't be reproduced automatically.
What are the 7 infrastructure? ›Seven Domains of IT Infrastructure Seven domains can be found in a typical IT infrastructure. They are as follows: User Domain, Workstation Domain, LAN Domain, LAN-to-WAN Domain, Remote Access Domain, WAN Domain, and System/Application Domain.
Why is infrastructure as code important? ›Infrastructure as Code increases efficiency and productivity for developers, architects, and administrators. First of all, it's easy to deploy complex cloud architectures using a combination of pre-configured IaC components, which dramatically shortens the development lifecycle.
Which three tools can you use to implement infrastructure as code? ›- AWS CloudFormation. We really cannot talk about IAC tools without talking about AWS CloudFormation. ...
- Azure Resource Manager. ...
- Google Cloud Deployment Manager. ...
- Terraform. ...
- Chef. ...
- Ansible. ...
- Puppet.
- Traditional infrastructure. With a traditional infrastructure, the components—like datacenters, data storage, and other equipment—are all managed and owned by the business within their own facilities. ...
- Cloud infrastructure. ...
- Hyperconverged infrastructure.
What are the 3 primary components of IT infrastructure? ›
The components of your standard IT infrastructure can be neatly broken down into the following three categories: hardware, software, and networking. While these represent the pillars of more traditional infrastructure, some of the same components are still used in cloud infrastructure.
What does infrastructure mean in IT examples? ›Infrastructure is the foundation or framework that supports a system or organization. In computing, information technology infrastructure is composed of physical and virtual resources that support the flow, storage, processing and analysis of data.
Should I pay to learn to code? ›Learning to code is worth it because it is a desirable skill in the workforce that can help you enter a steady career path. According to the US Bureau of Labor Statistics (BLS), software developers have a projected job outlook of 25 percent over the next decade.
Is coding a good way to make money? ›Coders can mostly make money by working full-time roles, freelancing, or by publishing apps, eBooks and online courses. In general, you can make money by either writing code, or teaching others how to do it.
How hard is IT to code software? ›Programming has a reputation for being one of the most difficult disciplines to master. Considering how different it is from traditional forms of education, including college degrees in computer science, it's not hard to see why some people have difficulty learning how to code.
What is the 5 type of IT infrastructure? ›Different types of IT infrastructure include software-defined, cloud, infrastructure-as-a-service (IaaS), composable, and converged and hyperconverged.
What are six major aspects of infrastructure? ›- Break Monolithic Architecture.
- Make Your Applications and Infrastructure Independent of each other.
- Cost-optimized Application and Infrastructure Modernization.
- Migration to the Cloud.
- Inbuilt Security.
- Integration of DevOps.
An IaC template creates the same environment every time it is run. DevOps teams can continuously test and evolve their templates until they reach an optimal environment setup for the applications and resources they want to run. IaC makes the environment part of a software release, managed as part of the CI/CD pipeline.
How do I know if my IaC is working? ›To check whether the idle air control valve is functioning properly, start the engine and let it run for about 10 to 15 minutes. If the valve is functioning correctly, the engine will sound good and the idle will be steady versus too high, too low, or inconsistent.
What are two types of infrastructure? ›Two main categories of infrastructure are hard and soft infrastructure. Soft infrastructures are the institutions that make up an economy, like healthcare systems, law enforcement, financial institutions and educational systems.
What are the 5 characteristics of infrastructure? ›
Investors seeking core infrastructure look for five different characteristics: income, low volatility of returns, diversification, inflation protection, and long-term liability matching.
What are two examples of infrastructure? ›Construction of roads, railways, bridges, tunnels, water supply, sewage, electrical grids, and telecommunications (including Internet connectivity and broadband access) are examples of large-scale public and private sector infrastructure projects that boost the economy of a society.
How to practice infrastructure as code? ›- Codifying Everything in IaC.
- Reduce the Documentation.
- Maintain Code in Version Control System.
- Test Integrates & Deploys with CI/CD.
- Modularization the Infrastructure.
- Terraform Cloud.
- Pulumi Service.
- AWS CloudFormation.
- Azure Resource Manager.
- Google Cloud Deployment Manager.
- Ansible Automation Platform.
- Spacelift.
The most important key to implement infrastructure security as Code is to implement the right tool to identify the issues with IaC templates/scripts and use the same approach to fix them . i.e. fixes and updates must also be applied through Code.
Which is a core part of infrastructure as code? ›The version control system (VCS) is a core part of infrastructure that is managed as code.
What language is Azure infrastructure as code? ›Azure Infrastructure as Code means you can model and manage Azure resources using programming languages such as C#/F#, Python, TypeScript/JavaScript, and Go.
Which is not an example of infrastructure as code tool? ›Docker is not an IaC tool. It is a popular containerization tool that enables developers to create applications with all libraries, dependencies as a package and deploy them in any environment.
What are the five 5 stages of the IT infrastructure evolution? ›There are broadly five key stages in the evolution of information technology infrastructure – the centralized mainframe, personal computing, the client/server era, enterprise computing, and the cloud.
How does IT infrastructure work? ›IT infrastructure, also called technology infrastructure, is what enables a company to build and run the applications that underpin its business. It includes compute, network, workplace and data platform capabilities.
What is the infrastructure model? ›
The IT infrastructure model illustrates the interrelationships between networks, as well as their hardware and structure. Thus, you can use it to entirely plan and document the network infrastructure.
What is infrastructure diagram? ›A technology infrastructure diagram provides a high-level graphical view of the physical architecture required to support the application architecture.
What is the difference between hardware and infrastructure? ›Hardware comprises the physical parts of a computer that can be touched, and infrastructure comprises the physical hardware used to connect computers to other computers and users.
What is basic infrastructure? ›In an organization or for a country, a basic infrastructure includes communication and transportation, sewage, water, education system, health system, clean drinking water, and monetary system.
What is another word for infrastructure? ›synonyms for infrastructure
On this page you'll find 21 synonyms, antonyms, and words related to infrastructure, such as: base, framework, footing, groundwork, root, and support.
Elements of IT that are not considered infrastructure include applications, data, and user devices. These elements are necessary to complete the IT infrastructure, but are not considered part of the core infrastructure.
How much do coders make? ›The national average salary for a computer programmer or coder is $73,473 per year . However, once you specialize in a certain area of coding , you have the potential to earn a higher wage. Salary expectations differ based on your job location and years of experience.
Can the average person learn to code? ›Almost anyone can learn to code. The challenge is finding the right resources. edX offers bootcamps and free online courses for computer programming, computer science, and a wealth of subfields such as data science, machine learning, and more.
Can I become millionaire by coding? ›However, the short answer is no, coding cannot make you rich on its own. In order to make a lot of money as a coder, you need to do more than simply code. Of course, the meaning of rich is subjective. If you simply want to live comfortably, coding is definitely a job in which you can make more than the average person.
How long does it take to learn coding? ›Most coders agree that it takes three to six months to be comfortable with the basics of coding. But you can learn coding faster or slower depending on your preferred pace.
Can I make 100k in coding? ›
Yes, you can make $100,000 per year as a programmer.
The chances of earning over $100k for a programmer are actually pretty good because the highest-paid programmer positions typically pay at least $103,000 per year. The average annual salary is $79,786 for programmer jobs.
In general, coding is a fairly relaxing job. There is the flexibility of working remotely as a programmer, and in many cases there is the security of routine. However, as with any job, whether coding is stressful depends largely on the company you work with. Cultural pressures and tight deadlines can cause stress.
What is the hardest type of code to learn? ›Malbolge. This language is so hard that it has to be set aside in its own paragraph. Malbolge is by far the hardest programming language to learn, which can be seen from the fact that it took no less than two years to finish writing the first Malbolge code.
Do you need a degree for coding? ›Still, you may be uncertain about how best to make the career leap if you've already attended university, have a job in another field or simply don't have the time to seek a conventional four-year degree. But don't worry — you don't need a degree to become a coder.
What are three elements of infrastructure as code IaC )? ›- Scripting. Writing scripts is the most direct approach to IaC. ...
- Configuration management tools. Also known as configuration as code, these are specialized tools designed to manage software. ...
- Provisioning tools. ...
- Containers and templating tools.
Faster speed and consistency: The goal of IaC is to make things faster by eliminating manual processes and eliminating the slack in the process. A code-based approach makes it easier to get more done in less time. No need to wait on the IT Admin to manually complete the task at hand before he can get to the next one.
What is infrastructure as code NIST? ›Definition(s): The process of managing and provisioning an organization's IT infrastructure using machine-readable configuration files, rather than employing physical hardware configuration or interactive configuration tools.
Which of the following problems are best solved by infrastructure as code? ›By replacing manual effort required for IT resource management and provisioning with simple lines of code, Infrastructure as Code helps to tackle the major issues of manual setups such as environment drift in the release pipeline, slow provisioning, lack of workflow automation, lack of reusability and high price.
Is pipeline as code the same as infrastructure as code? ›Pipeline as code is a practice of defining deployment pipelines through source code, such as Git. Pipeline as code is part of a larger “as code” movement that includes infrastructure as code.
Which of these are tools for infrastructure as code? ›HashiCorp Terraform is the most popular open-source tool for infrastructure automation. It helps in configuring, provisioning, and managing the infrastructure as code.
What are the 5 types of IT infrastructure? ›
Different types of IT infrastructure include software-defined, cloud, infrastructure-as-a-service (IaaS), composable, and converged and hyperconverged.
What are the 7 domains of IT infrastructure? ›Seven Domains of IT Infrastructure Seven domains can be found in a typical IT infrastructure. They are as follows: User Domain, Workstation Domain, LAN Domain, LAN-to-WAN Domain, Remote Access Domain, WAN Domain, and System/Application Domain.
What are five important facts you would like to remember about infrastructure as code? ›- Reproduce Systems Easily. Your IaC strategy should help you build and rebuild any element of your IT infrastructure with ease and speed. ...
- Idempotence. ...
- Repeatable Processes. ...
- Disposable Systems. ...
- Ever-evolving Design.
IaC prevents drift by provisioning the same environment every time. Faster, more efficient development: By simplifying provisioning and ensuring infrastructure consistency, IaC can confidently accelerate every phase of the software delivery lifecycle.
What are the 5 functions described in the NIST framework? ›It consists of five concurrent and continuous Functions: Identify, Protect, Detect, Respond and Recover.
What is no code infrastructure? ›No-code is a term used to describe a method of creating software, such as websites and apps, using visual drag-and-drop interfaces instead of code. In other words, no-code allows anyone, regardless of their technical ability, to build on the internet.
What is the difference between NIST and CIS standards? ›As we mentioned, CIS focuses specifically on cybersecurity, while NIST's mission is broader in scope. The types of resources each organization offers show this difference. For example, CIS offers resources like security benchmarks and threat intelligence, while NIST's focus is more on developing standards and guidance.