Bootstrap: bootstrapping multiple environments with same bootstrap-bucket-name causes inconsistent stack creation

Abierto
#96 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
aws, typescript
Área
cli, cloud

Línea de trabajo

Comienza con BootstrapEnvironmentOptions y la implementación de la CLI en packages/aws-cdk/lib/cli/cdk-toolkit.ts en las líneas 963-989; después, inspecciona BootstrappingParameters en packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts. Traza cómo bootstrapEnvironment recibe estas opciones y determina cómo se pueden definir los parámetros por entorno. La tarea estará terminada cuando inicializar varias entornos con un nombre de bucket personalizado ya no haga que los entornos posteriores fallen debido a una configuración compartida.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

p2

Bootstrap fails when multiple environments are being bootstrapped with a custom bucketName

Description

Users can pass in BootstrappingParameters to modify how resources are created during bootstrap:
https://github.com/aws/aws-cdk-cli/blob/7517ecc2ded9169028540bc3bfdc8e320b161043/packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts#L66-L72

If bucketName is passed in, bootstrap will attempt to create the bucket. If the bucket already exists, the bootstrap operation will fail.

When bootstrapping multiple environments, it is possible to pass in bucketName. However, this will cause at least one environment to fail bootstrapping. Assuming the bucket name is not already taken, the first environment that is bootstrapped will use that bucket name and succeed. All other environments will fail to bootstrap, since the bucket name is already taken.

Reproduction
Command-line:
cdk bootstrap --all \
  --bootstrap-bucket-name my-custom-parameters-bucket-481665128236 \
  aws://481665128236/us-east-2 \
  aws://481665128236/us-west-1
Result:

Only one environment is bootstrapped successfully.

Image Image
Proposed fix

BootstrappingParameters should be passed in per-environment. It should remain optional. The current CLI implementation is as follows:
https://github.com/aws/aws-cdk-cli/blob/7517ecc2ded9169028540bc3bfdc8e320b161043/packages/aws-cdk/lib/cli/cdk-toolkit.ts#L963-L989

BootstrapEnvironmentOptions is bootstrap-action-scoped (i.e. account-scoped), but it is passed into bootstrapEnvironment, an environment-scoped (i.e. region-scoped) function.

Consider something like the following as a param for bootstrap:

interface EnvironmentBootstrapConfig {
  readonly environment: string;  // The environment descriptor (e.g. 'aws://123456789012/us-east-1')
  readonly parameters?: BootstrappingParameters;
  // Other environment-specific options that were previously in BootstrapOptions
}
Lenguaje dominante
TypeScript
Estrellas
110
Forks
138
Merge medio
1 d 9 h
PR fusionados (30 d)
55

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de aws/aws-cdk-cli

Todos los issues de aws/aws-cdk-cli

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.