0
0
Terraformcloud~20 mins

Blue-green infrastructure pattern in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Blue-Green Deployment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Architecture
intermediate
2:00remaining
Identify the main benefit of the blue-green deployment pattern
Which of the following best describes the primary advantage of using the blue-green deployment pattern in cloud infrastructure?
AIt allows zero downtime deployments by switching traffic between two identical environments.
BIt reduces cloud costs by using only one environment at a time.
CIt automatically scales resources based on traffic load.
DIt encrypts all data in transit between environments.
Attempts:
2 left
💡 Hint
Think about how traffic is managed during updates.
Configuration
intermediate
2:00remaining
Terraform snippet for blue-green environment switching
Given two identical AWS ECS services named blue and green, which Terraform snippet correctly switches the production traffic to the green service using an Application Load Balancer listener rule?
Terraform
resource "aws_lb_listener_rule" "green_traffic" {
  listener_arn = aws_lb_listener.front_end.arn
  priority     = 100

  action {
    type             = "forward"
    target_group_arn = aws_lb_target_group.green.arn
  }

  condition {
    path_pattern {
      values = ["/app/*"]
    }
  }
}
AUse aws_lb_listener_rule with action type 'forward' to green target group and priority lower than blue's rule.
BUse aws_lb_listener_rule with action type 'redirect' to green target group and priority higher than blue's rule.
CUse aws_lb_listener_rule with action type 'fixed-response' to green target group and priority equal to blue's rule.
DUse aws_lb_listener_rule with action type 'forward' to green target group and priority higher than blue's rule.
Attempts:
2 left
💡 Hint
Higher priority rules take precedence in ALB listener rules.
security
advanced
2:00remaining
Security considerations in blue-green deployments
Which security risk is most relevant when running both blue and green environments simultaneously in a blue-green deployment?
AInability to encrypt data in transit between environments.
BData loss caused by switching traffic between environments.
CIncreased attack surface due to both environments being live and accessible.
DAutomatic deletion of logs from the inactive environment.
Attempts:
2 left
💡 Hint
Think about exposure when two environments are active.
Best Practice
advanced
2:00remaining
Best practice for database handling in blue-green deployments
In a blue-green deployment, what is the recommended approach to handle database schema changes to avoid downtime?
AApply backward-compatible schema changes before switching traffic, then clean up old schema after verification.
BAvoid any schema changes during blue-green deployments to prevent conflicts.
CMaintain separate databases for blue and green environments and merge data after deployment.
DSwitch traffic first, then apply schema changes directly on the new environment's database.
Attempts:
2 left
💡 Hint
Consider how to keep both environments compatible during transition.
service_behavior
expert
2:00remaining
Result of traffic switch in blue-green deployment with sticky sessions
In a blue-green deployment using an Application Load Balancer with sticky sessions enabled, what is the expected behavior immediately after switching traffic from blue to green environment?
AAll users are instantly routed to the green environment regardless of existing sessions.
BExisting users continue to be routed to the blue environment until their session expires, new users go to green.
CSticky sessions are disabled automatically during the switch causing all users to lose session data.
DThe load balancer duplicates traffic to both blue and green environments during the switch.
Attempts:
2 left
💡 Hint
Sticky sessions bind users to a specific backend until session ends.