Перейти до основного вмісту
🔒 Режим прев'ю. Перші 15 уроків Foundations — безкоштовні; цей — Pro. Запусти 7-денний trial щоб відкрити редактор, AI-підказки і решту курсу. Потрібна картка, скасування в Dashboard у будь-який момент.Почати 7-денний trial →
⚡
← Курси›DevOps for Python servicesМодуль 1 · Докер і контейнери›

Інфраструктура як код (Terraform)

predict6 / 104
+100 XP
Завдання🌐 shown in EN
📝 **Task:** The snippet models what `terraform plan` does: it diffs the state against the desired HCL. Predict the exact summary line it prints for the scenario above. 📋 Implement the function above. Tests run automatically. 💡 **Hint:** Re-read the theory if you get stuck.
Передбач вивід

Прочитай код уважно

state = {
    "aws_s3_bucket.uploads": {"bucket": "myapp-uploads-prod"},
    "aws_lambda_function.image_resize": {"runtime": "python3.11"},
    "aws_iam_role.lambda_exec": {"name": "lambda-exec"},
}
desired = {
    "aws_s3_bucket.uploads": {"bucket": "myapp-uploads-prod"},
    "aws_lambda_function.image_resize": {"runtime": "python3.12"},
    "aws_cloudwatch_log_group.lambda_logs": {"name": "/aws/lambda/image-resize"},
}

add = [r for r in desired if r not in state]
destroy = [r for r in state if r not in desired]
change = [r for r in desired if r in state and desired[r] != state[r]]

print(f"Plan: {len(add)} to add, {len(change)} to change, {len(destroy)} to destroy.")

Що виведе програма? Напиши тут: