feat(terraform): support long running applies - #200
Conversation
02147c9 to
9c26949
Compare
9c26949 to
c7aa613
Compare
PaulArnaud
left a comment
There was a problem hiding this comment.
Did you test this PR by using
sencrop/github-workflows/.github/workflows/terraform-apply-v2.yml@feat/long-running-terraform-applies in one of your workflow somewhere ? Just to be sure to not break any CI
Third try of the b/g deployment will be a good test :D |
|
FYI, this version is currently being tested in this run. Edit: It was using the master version of
|
|
The changes work, https://github.com/sencrop/sencrop-mysql-management/actions/runs/33149289466/job/98777288430, I will merge this PR. |
Problem
A
terraform applyon thesencrop-preproduction-mysql8Blue/Green deployment failed after one hour:This is not an RDS error: the STS session expired while terraform was still waiting. Nothing in the workflow allowed a run to go past one hour.
What was in the way
configure-aws-credentialsnever passedrole-duration-seconds, which defaults to 3600timeout-minutesonterraform-apply-v2Changes
actions/configure-aws-credentials: newrole_duration_secondsinput, forwarded asrole-duration-seconds. The AWS action does not infer the duration from the role, it always asks for one hour unless told otherwise, even on a role that allows twelve.terraform-apply-v2:role_duration_secondsandtimeout_minutesinputs, the latter wired to the jobtimeout-minutes.The defaults (
3600and360) match the current behaviour, so no existing caller is affected.IAM prerequisite
role_duration_secondscannot exceed themax_session_durationof the assumed role, otherwiseAssumeRoleWithWebIdentityis rejected and the job fails while configuring the credentials. Our roles are created at 3600, so a caller asking for a longer session needs either a raisedmax_session_durationongithub-actions-<repository>, or a dedicated role passed through the existingci_iam_roleinput. The README documents when each one applies.12h is the AWS maximum for a role assumed through OIDC.
Related PR: https://github.com/sencrop/infra-ci/pull/403