[FIX] Terraform Cloud Run CI 실패 수정 (#486)#487
Conversation
Summary of ChangesHello @IISweetHeartII, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 Pull Request는 Terraform CI 파이프라인에서 발생하는 plan 실패 문제를 해결하기 위해 Cloud Run 서비스의 Terraform 설정을 수정합니다. 주요 변경 사항은 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Terraform Format and Style 🖌
|
There was a problem hiding this comment.
Code Review
이 PR은 img_resizer Cloud Run 서비스의 Terraform CI 실패를 해결하기 위해 prevent_destroy 라이프사이클 설정을 제거하고 ignore_changes를 수정합니다. 상태 드리프트(state drift)로 인해 발생한 문제를 해결하기 위한 올바른 방향의 수정입니다. 다만, prevent_destroy를 영구적으로 제거하는 것은 프로젝트의 운영 가이드에 위배될 수 있으며, 리소스의 안정성을 저해할 수 있습니다. 이에 대해 더 안전한 대안을 제시하는 리뷰 의견을 남겼습니다.
| } | ||
|
|
||
| lifecycle { | ||
| prevent_destroy = true |
There was a problem hiding this comment.
CI 실패 문제를 해결하기 위해 prevent_destroy를 제거하는 것은 이해됩니다. 하지만 이는 TERRAFORM_OPERATIONS.md 운영 가이드의 안전 수칙에 위배될 수 있으며, 향후 img-resizer 서비스가 의도치 않게 삭제될 위험을 만듭니다.
이 변경이 상태 드리프트(state drift) 해결을 위한 일회성 조치라면, prevent_destroy를 영구적으로 제거하는 대신 다음의 2단계 접근 방식을 고려하는 것이 더 안전합니다.
- 현재 PR에서
prevent_destroy를 제거하여apply를 통해 상태를 바로잡습니다. - 즉시 후속 PR을 통해
prevent_destroy = true를 다시 추가하여 리소스 보호 설정을 복원합니다.
이렇게 하면 현재 문제를 해결하면서도 장기적인 안정성을 유지할 수 있습니다.
References
docs/infra/TERRAFORM_OPERATIONS.md가이드라인(72라인)에서는 데이터 손실 및 서비스 중단을 방지하기 위해 주요 리소스의prevent_destroy속성 제거를 금지하고 있습니다. 이 규칙은 리소스가 실수로 삭제되는 것을 방지하는 중요한 안전장치입니다. (link)
Summary
Cloud Run
img_resizer의prevent_destroylifecycle 제거 및ignore_changes최소화로 Terraform CI plan 실패 수정.Changes
prevent_destroy = true제거 — CI plan에서 force-replacement 시도 시 plan 자체를 차단하던 원인ignore_changes에서template[0].containers[0].image제거 — img-resizer는 고정 태그(:3)로 Terraform이 완전 관리client,client_version만 ignore 유지 — GCP가 자동 설정하는 메타데이터Type of Change
Related Issues
Closes #486
Checklist
Additional Notes
근본 원인: 마이그레이션 중
gcloud run deploy로 img-resizer를 배포하면서 Terraform state와 실제 Cloud Run 속성 사이에 drift 발생.prevent_destroy가 Terraform plan의 reconciliation을 차단.수정 후 동작: develop 머지 시 Terraform apply가 실행되면서 state와 실제 리소스를 자동 reconcile. img-resizer 이미지 업데이트는
cloudrun.tf의 태그를 수정하여 PR로 관리.