fix(infra): 公開 SSM parameter の読み取りを terraform-apply に許可する - #110
Merged
Conversation
Deny を絞っただけでは apply が通らなかった。RegionalInfra が持つのは ssm:DescribeParameters だけで、GetParameter の Allow がどこにも無いため bastion の AMI 参照が「no identity-based policy allows」で落ちる。 読めるのは AWS 公開の /aws/service/* に限る。この ARN は account 部が空で、 自アカウントの parameter を落とす Deny とは重ならない。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
問題
#109 で Deny を自アカウントの parameter に絞ったが、それだけでは踏み台の apply が通らない。
terraform-applyが持つ SSM の Allow はRegionalInfraのssm:DescribeParametersだけで、GetParameterの Allow がどこにも無い。#109 で explicit deny は消えたが、今度は Allow の欠落で落ちる。変更内容
AWS が公開する
/aws/service/*に限ってssm:GetParameter/GetParametersを許可する。この ARN は #109 で入れた Deny (
arn:aws:ssm:*:<account>:parameter/*) と重ならないため、自アカウントの/vector/*は引き続き読めない。この namespace に居るのは AMI ID などの公開値だけで、秘密は含まれない。経緯
この commit は #109 の merge 直後に同じブランチへ push してしまい、PR に取り込まれなかった。内容は #109 のレビュー時に想定していたものと同じで、main へ入れ直すための PR。
検証
terraform validate/fmt済み。plan は0 to add, 1 to change, 0 to destroyで、applypolicy に Allow 文が 1 つ増えるだけ。apply 後、踏み台の apply が通ることを実機で確認する。
🤖 Generated with Claude Code