Scenario
I am using bastion host module to deploy a bastion host to reach the internal applications in GCP. However, I got the following error when I try to use the default template in the module's README page:
Error: Error retrieving IAM policy for iap tunnelinstance "projects/test-project/iap_tunnel/zones/europe-west2-a/instances/bastion-vm": googleapi: Error 403: The caller does not have permission
Question
In one of my projects, I encountered this error for which I could not locate a solution. Therefore, I wanted to create this entry so that anyone who encounters the same error can simply resolve their issue.
PS: You can find the solution down below :)
The answer is straightforward. Simply assign the
roles/iam.securityAdminrole to the deployer service account in Terraform, and you're all set. I believe it will be a simple solution for people.