[Feature Request] Cloud Compute Defined Environment Variables

Aperta
#833 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
aws, typescript
Ambito
cloud, devops

Direzione di ricerca

Start by reading the plugin and initialization documentation referenced by the .env.schema example, then inspect how existing plugins resolve configuration and populate environment variables. The request proposes looking up Lambda environment settings and resolving SSM parameters or Secrets Manager values, with ECS task definitions as a possible extension. Done would mean agreeing on scope and a supported resolution flow, then documenting and implementing it; the issue names no files or tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
Description

I deploy my compute workloads to AWS Lambda and ECS Fargate. I use the AWS CDK to define my functions/containers, including environment variables. Example:

const fn = new nodejs.NodejsFunction(this, 'MyFunction', {
  entry: '/path/to/my/file.ts',
  environment: {
    ENVIRONMENT: "prod",
    FEATURE_FLAG_1: "1",
});
// external param
const apiUrlParam = ssm.StringParameter.fromStringParameterAttributes(this, 'ImportedApiUrl', {
      parameterName: '/config/api_url',
    });
fn.addEnvironment("MY_API_KEY", apiUrlParam.stringValue);
apiUrlParam.grantRead(fn);
// external secret
const mySecret = secretsmanager.Secret.fromSecretNameV2(
      this, 
      'ImportedSecret', 
      'my-api-credentials'
    );
fn.addEnvironment("MY_API_CREDS_ARN", mySecret.secretArn);
mySecret.grantRead(fn);

Now, I have to duplicate all of this in my local .env.schema for varlock to read env vars. BUT, what if varlock could resolve all of this for me?

Motivation

I don't want to have to duplicate env var configuration across my infrastructure-as-code + varlock.

Proposed Solution

.env.schema

# @plugin(@varlock/aws-lambda-env-plugin, "MyLambdaFunction")
# @initAws(region=$AWS_REGION, profile=$AWS_PROFILE)
# ---

# Environment from my AWS Lambda function are automatically resolved. Yay!

Notice the plugin needs to set multiple env vars. The plugin would look up the lambda function, then find the configuration that defines the environment variables, resolve them (sometimes reaching out to SSM or SecretsManager in the process), and set them locally.

Alternatives

Duplicate environment configuration.

Additional Information

Would be great to also have this for ECS (Containers Service). You'd want to resolve the ECS Task Definition which contains environment configuration.

Lingua principale
TypeScript
Stelle
4.9k
Fork
140
Merge medio
2g 3h
PR unite (30g)
35

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dmno-dev/varlock

Tutte le issue di dmno-dev/varlock

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.