|
| 1 | +# Terraform Infrastructure Report |
| 2 | + |
| 3 | +## 1. Cloud Provider Chosen and Why |
| 4 | + |
| 5 | +**Cloud Provider:** Yandex Cloud |
| 6 | + |
| 7 | +Yandex Cloud was chosen because: |
| 8 | + |
| 9 | +- It provides full Infrastructure as Code (IaC) support through the official Terraform provider. |
| 10 | +- It offers simple VPC, compute, and security group configuration suitable for educational projects. |
| 11 | +- It supports fine-grained IAM roles and service accounts for secure automation. |
| 12 | +- It provides public IP (NAT) configuration directly in the compute instance resource. |
| 13 | + |
| 14 | +Terraform was used as the Infrastructure as Code tool because it allows: |
| 15 | + |
| 16 | +- Declarative infrastructure definition |
| 17 | +- Version-controlled infrastructure |
| 18 | +- Reproducible environments |
| 19 | +- Automated provisioning |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## 2. Terraform Version Used |
| 24 | + |
| 25 | +Terraform version used: |
| 26 | + |
| 27 | +terraform version |
| 28 | +Terraform v1.x.x |
| 29 | + |
| 30 | + |
| 31 | +Provider version: |
| 32 | + |
| 33 | +yandex-cloud/yandex v0.187.0 |
| 34 | + |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +## 3. Resources Created |
| 39 | + |
| 40 | +The following resources were provisioned: |
| 41 | + |
| 42 | +### Network |
| 43 | +- VPC Network: `net` |
| 44 | +- Subnet: `subnet` |
| 45 | +- CIDR block: `10.0.0.0/24` |
| 46 | +- Zone: `ru-central1-a` |
| 47 | + |
| 48 | +### Security Group |
| 49 | +Inbound rules: |
| 50 | +- SSH (22) — allowed only from personal IP (`<MY_IP>/32`) |
| 51 | +- HTTP (80) — allowed from `0.0.0.0/0` |
| 52 | +- TCP 5000 — allowed from `0.0.0.0/0` |
| 53 | + |
| 54 | +Outbound: |
| 55 | +- All traffic allowed |
| 56 | + |
| 57 | +### Virtual Machine |
| 58 | +- Name: `terraform1` |
| 59 | +- Platform: `standard-v2` |
| 60 | +- CPU: 2 cores |
| 61 | +- RAM: 2 GB |
| 62 | +- OS: Ubuntu 22.04 LTS |
| 63 | +- Public NAT enabled |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +## 4. Public IP Address of Created VM |
| 68 | + |
| 69 | +```text |
| 70 | +93.77.177.208 |
| 71 | +``` |
| 72 | + |
| 73 | +(Obtained from Terraform output.) |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## 5. SSH Connection Command |
| 78 | + |
| 79 | + |
| 80 | +```shell |
| 81 | +ssh ubuntu@93.77.177.208 |
| 82 | +``` |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## 6. Terminal Output – terraform plan |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +## 7. Terminal Output – terraform apply |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | +--- |
| 98 | + |
| 99 | +## 8. Proof of SSH Access to VM |
| 100 | + |
| 101 | +After successful SSH login: |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | +# Infrastructure Migration Report: Terraform → Pulumi |
| 107 | + |
| 108 | +## 1. Programming Language Chosen for Pulumi |
| 109 | + |
| 110 | +**Language:** Python |
| 111 | + |
| 112 | +Reasoning: |
| 113 | +- Simple syntax and readability |
| 114 | +- Good integration with Pulumi SDK |
| 115 | +- Fast setup for infrastructure scripting |
| 116 | +- Suitable for backend-oriented workflow |
| 117 | + |
| 118 | +Pulumi version used: |
| 119 | + |
| 120 | +pulumi version |
| 121 | +v3.x.x |
| 122 | + |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## 2. Terraform Destroy Output |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | +--- |
| 131 | + |
| 132 | +## 3. Pulumi Preview Output |
| 133 | + |
| 134 | + |
| 135 | +--- |
| 136 | + |
| 137 | +## 4. Pulumi Up Output |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | +--- |
| 143 | + |
| 144 | +## 5. Public IP of Pulumi-Created VM |
| 145 | + |
| 146 | +51.250.xxx.xxx |
| 147 | + |
| 148 | + |
| 149 | +SSH access: |
| 150 | + |
| 151 | +```shell |
| 152 | +ssh ubuntu@51.250.xxx.xxx |
| 153 | +``` |
| 154 | + |
| 155 | + |
| 156 | +![login]() |
| 157 | + |
| 158 | + |
| 159 | +--- |
| 160 | + |
| 161 | +## 6. Comparison: Terraform vs Pulumi Experience |
| 162 | + |
| 163 | +### What Was Easier in Terraform |
| 164 | + |
| 165 | +- Clear declarative structure |
| 166 | +- Simple `.tf` syntax |
| 167 | +- Strong ecosystem and documentation |
| 168 | +- Easier to understand infrastructure layout at a glance |
| 169 | + |
| 170 | +### What Was Harder in Terraform |
| 171 | + |
| 172 | +- Limited logic capabilities |
| 173 | +- No native loops or conditions without workarounds |
| 174 | +- Separate HCL language (not general-purpose) |
| 175 | + |
| 176 | +--- |
| 177 | + |
| 178 | +### What Was Easier in Pulumi |
| 179 | + |
| 180 | +- Full programming language support (Python) |
| 181 | +- Ability to use variables, loops, conditions naturally |
| 182 | +- Better abstraction and reuse potential |
| 183 | +- Dynamic infrastructure definitions |
| 184 | + |
| 185 | +### What Was Harder in Pulumi |
| 186 | + |
| 187 | +- More verbose code |
| 188 | +- Requires dependency management (venv, pip) |
| 189 | +- Slightly more complex project structure |
| 190 | +- Harder to quickly read compared to simple HCL |
| 191 | + |
| 192 | +--- |
| 193 | + |
| 194 | +## 7. Code Differences (HCL vs Python) |
| 195 | + |
| 196 | +### Terraform (HCL Example) |
| 197 | + |
| 198 | +```hcl |
| 199 | +resource "yandex_compute_instance" "vm" { |
| 200 | + name = "terraform1" |
| 201 | +
|
| 202 | + resources { |
| 203 | + cores = 2 |
| 204 | + memory = 2 |
| 205 | + } |
| 206 | +
|
| 207 | + network_interface { |
| 208 | + subnet_id = yandex_vpc_subnet.subnet.id |
| 209 | + nat = true |
| 210 | + } |
| 211 | +} |
| 212 | +Characteristics: |
| 213 | +
|
| 214 | +Declarative |
| 215 | +
|
| 216 | +Resource-based |
| 217 | +
|
| 218 | +Static structure |
| 219 | +
|
| 220 | +Limited programmability |
| 221 | +
|
| 222 | +Pulumi (Python Example) |
| 223 | +import pulumi |
| 224 | +import pulumi_yandex as yandex |
| 225 | +
|
| 226 | +network = yandex.VpcNetwork("net") |
| 227 | +
|
| 228 | +subnet = yandex.VpcSubnet("subnet", |
| 229 | + network_id=network.id, |
| 230 | + zone="ru-central1-a", |
| 231 | + v4_cidr_blocks=["10.0.0.0/24"] |
| 232 | +) |
| 233 | +
|
| 234 | +vm = yandex.ComputeInstance("vm", |
| 235 | + resources=yandex.ComputeInstanceResourcesArgs( |
| 236 | + cores=2, |
| 237 | + memory=2 |
| 238 | + ), |
| 239 | + network_interfaces=[yandex.ComputeInstanceNetworkInterfaceArgs( |
| 240 | + subnet_id=subnet.id, |
| 241 | + nat=True |
| 242 | + )] |
| 243 | +) |
| 244 | +
|
| 245 | +pulumi.export("public_ip", vm.network_interfaces[0].nat_ip_address) |
| 246 | +Characteristics: |
| 247 | +
|
| 248 | +Imperative style |
| 249 | +
|
| 250 | +Uses full Python language |
| 251 | +
|
| 252 | +Allows dynamic logic |
| 253 | +
|
| 254 | +Code-first infrastructure |
| 255 | +
|
| 256 | +8. Preferred Tool and Why |
| 257 | +Preferred tool: Terraform |
| 258 | +
|
| 259 | +Reason: |
| 260 | +
|
| 261 | +Simpler for small and medium infrastructure |
| 262 | +
|
| 263 | +Clear declarative model |
| 264 | +
|
| 265 | +Easier for teams without strong programming background |
| 266 | +
|
| 267 | +More standardized in DevOps industry |
| 268 | +
|
| 269 | +Pulumi is more flexible and powerful for complex, dynamic environments, but for straightforward infrastructure provisioning Terraform is more concise and easier to maintain. |
0 commit comments