Ugrás a fő tartalomra
🔒 Előnézet mód. Az első tizenöt Foundations lecke ingyenes; ez Pro. Indíts 7 napos trial-t, hogy feloldd a szerkesztőt, az AI tippeket és a tananyag többi részét. Kártya szükséges, bármikor lemondhatod a Dashboard-ban.7 napos trial indítása →
⚡
← Kurzusok›DevOps for Python services1. modul · Dokkoló és konténerek›

Infrastruktúra mint kód (terraform)

predict6 / 104
+100 XP
Feladat🌐 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.
Találd ki a kimenetet

Olvasd el a kódot figyelmesen

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.")

Mit ír ki a program? Írd ide: