Can't grant permissions on secrets
See original GitHub issueIn our new deployments, I’ve been trying to assign secretmanager.secretAccessor
on a specific secret to a given service account.
Is this an impossible feat? I’ve managed to create a type provider for the secret manager API, but cannot assign the required permissions.
This is a minimal deployment of the secret:
resources:
# Service account needing secretAccessor
- name: account-user123
type: iam.v1.serviceAccount
properties:
accountId: user123
displayName: user123
# Create secret
- name: secret-parent-up-auth_secret
action: [PROJECT_ID]/secret-manager:secretmanager.projects.secrets.create
properties:
replication:
automatic: {}
parent: projects/[PROJECT_ID]
secretId: auth_secret
metadata:
runtimePolicy:
- CREATE
dependsOn:
- api-secretmanager
- type-provider-secret-manager
# Delete secret
- name: secret-parent-down-auth_secret
action: [PROJECT_ID]/secret-manager:secretmanager.projects.secrets.delete
properties:
name: projects/155387989549/secrets/auth_secret
metadata:
runtimePolicy:
- DELETE
dependsOn:
- type-provider-secret-manager
# Deploy secret version
- name: secret-version-auth_secret_payload
action: [PROJECT_ID]/secret-manager:secretmanager.projects.secrets.addVersion
properties:
parent: projects/[PROJECT_ID]/secrets/auth_secret
payload:
data: c3RhcmZpc2g=
metadata:
dependsOn:
- secret-parent-up-auth_secret
# Deploy secret manager type provider
- name: type-provider-secret-manager
type: gcp-types/deploymentmanager-v2beta:typeProviders
properties:
name: secret-manager
descriptorUrl: https://secretmanager.googleapis.com/$discovery/rest?version=v1beta1
options:
inputMappings:
- fieldName: Authorization
location: HEADER
value: $.concat("Bearer ", $.googleOauth2AccessToken())
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Resolve Secrets Manager secret access errors after ... - AWS
I attempted to retrieve or access an AWS Secrets Manager secret, and received an error similar to one of the following: "You can't...
Read more >Grant permission to applications to access an Azure key vault ...
Go to key vault Access control (IAM) tab and remove "Key Vault Secrets Officer" role assignment for this resource. Remove assignment - key...
Read more >Access control with IAM - Secret Manager - Google Cloud
To create, manage, list, or access a secret, the appropriate IAM permissions must be granted at the project level and at the individual...
Read more >Can't access secret stored in Secrets Manager from Google ...
Can you share the full error message? · And did you grant the Cloud Function's service account permissions to access the secret? ·...
Read more >Grant AWS Lambda Access to Secrets Manager | bobbyhadz
In order to grant a Lambda function access to Secrets Manager, we have to ... If your function is still unable to access...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
What does work, but gives access to all project secrets (which is obviously too generous):
@ocsig Got it, thanks for the insights ❤️