背景
あるプロジェクトをVPCSCでGCSにIP制限をかけた。
そのGCSでService Transfer Service (S3 -> GCS)を実行しようとしたら以下のエラーがでた。
VPC Service Controls
Cloud Storage
testIamPermissions
project-xxxx@storage-transfer-service.iam.gserviceaccount.com
Request is prohibited by organization's policy. vpcServiceControlsUniqueIdentifier: xxx
監査ログでは以下のようなログ
requestMetadata: {
callerIp: "private"
destinationAttributes: {
}
requestAttributes: {
}
}
resourceName: "projects/xxx"
serviceName: "storage.googleapis.com"
解決方法
Access Context Managerに project-${project_number}@storage-transfer-service.iam.gserviceaccount.com
のアカウントを追加したら動いた。
自分のプロジェクトでは、Access Context Managerはyaml管理されているのでyamlに上記アカウント追加して access context manager の updateコマンドを実行した。
gcloud access-context-manager levels update accessPolicies/xxx/accessLevels/gdp --basic-level-spec=sample.yaml --combine-function=or
sample.yaml
- ipSubnetworks:
- xxx.xxx.xxx.xxx/32
- xxx.xxx.xxx.xxx/32
- members:
- project-${project_number}@storage-transfer-service.iam.gserviceaccount.com