Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Gitlab Token from Secrets Manager #1538

Open
1 of 2 tasks
Obirah opened this issue Jul 10, 2023 · 2 comments
Open
1 of 2 tasks

Feature: Gitlab Token from Secrets Manager #1538

Obirah opened this issue Jul 10, 2023 · 2 comments

Comments

@Obirah
Copy link

Obirah commented Jul 10, 2023

The GitLab Runner should be able to dynamically resolve the GitLab token from AWS Secrets Manager.

Use Case

Get rid of the need to pass a token and write it into the resulting CloudFormation template in clear text.

Proposed Solution

  • Introduce an additional field gitlabTokenSecretName into the props.
  • If gitlabToken is not specified and gitlabTokenSecretName is, the construct adds the command $(aws secretsmanager get-secret-value --region ${Aws.REGION} --secret-id gitlab-runner --query SecretString --output text | grep -o '"registration-token":"[^"]*' | grep -o '[^"]*$') instead of the clear text token into the user data.
  • If gitlabTokenSecretName is specified, the constructs adds read permissions for the secrets to the instance role:
    instanceRole.addToPrincipalPolicy(new PolicyStatement({
          actions: [
              "secretsmanager:GetSecretValue"
          ],
          effect: Effect.ALLOW,
          resources: [
              `arn:aws:secretsmanager:${Aws.REGION}:${Aws.ACCOUNT_ID}:secret:gitlab-runner*`
          ]
    }));
    

Other

Successfully tested the proposed solution with the existing construct.

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@neilkuan
Copy link
Owner

Nice feature, Go build it.

@aarcro
Copy link

aarcro commented Mar 28, 2024

You already put the token in SSM, just remove it from the userdata, and have userdata fetch the value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants