@@ -334,13 +334,49 @@ stacks that will be deployed in the environment. The top level keyword
334
334
*stacks * is populated with a list of dictionaries, each representing a single
335
335
stack to be built.
336
336
337
- A stack has the following keys:
337
+ Stacks are managed by Stacker by default. They will be created and updated as
338
+ needed using the template file or blueprint class specified. Stacks that are
339
+ created by external tools and meant to be used only as references for output
340
+ lookups can be marked as *external *.
341
+
342
+ The following options are available for all stacks:
338
343
339
344
**name: **
340
345
The logical name for this stack, which can be used in conjuction with the
341
346
``output `` lookup. The value here must be unique within the config. If no
342
347
``stack_name `` is provided, the value here will be used for the name of the
343
348
CloudFormation stack.
349
+ **stack_name: **
350
+ (optional) If provided, this will be used as the name of the CloudFormation
351
+ stack. Unlike ``name ``, the value doesn't need to be unique within the config,
352
+ since you could have multiple stacks with the same name, but in different
353
+ regions or accounts. (note: the namespace from the environment will be
354
+ prepended to this)
355
+ **region **:
356
+ (optional): If provided, specifies the name of the region that the
357
+ CloudFormation stack should reside in. If not provided, the default region
358
+ will be used (``AWS_DEFAULT_REGION ``, ``~/.aws/config `` or the ``--region ``
359
+ flag). If both ``region `` and ``profile `` are specified, the value here takes
360
+ precedence over the value in the profile.
361
+ **profile **:
362
+ (optional): If provided, specifies the name of a AWS profile to use when
363
+ performing AWS API calls for this stack. This can be used to provision stacks
364
+ in multiple accounts or regions.
365
+ **external **:
366
+ (optional): If set to true, this stack is considered read-only, will not be
367
+ modified by Stacker, and most of the options related to stack deployment
368
+ should be omitted.
369
+
370
+ External stacks accept the following additional options:
371
+
372
+ **fqn **:
373
+ (optional): Fully-qualified physical name of the stack to be loaded from
374
+ CloudFormation. Use instead of ``stack_name `` if the stack lies in a
375
+ different namespace, as this value *does not * get the namespace applied to
376
+ it.
377
+
378
+ Managed stacks accept the following additional options:
379
+
344
380
**class_path: **
345
381
The python class path to the Blueprint to be used. Specify this or
346
382
``template_path `` for the stack.
@@ -350,7 +386,6 @@ A stack has the following keys:
350
386
working directory (e.g. templates stored alongside the Config), or relative
351
387
to a directory in the python ``sys.path `` (i.e. for loading templates
352
388
retrieved via ``packages_sources ``).
353
-
354
389
**description: **
355
390
A short description to apply to the stack. This overwrites any description
356
391
provided in the Blueprint. See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-description-structure.html
@@ -363,8 +398,10 @@ A stack has the following keys:
363
398
updated unless the stack is passed to stacker via the *--force * flag.
364
399
This is useful for *risky * stacks that you don't want to take the
365
400
risk of allowing CloudFormation to update, but still want to make
366
- sure get launched when the environment is first created. When ``locked ``,
367
- it's not necessary to specify a ``class_path `` or ``template_path ``.
401
+ sure get launched when the environment is first created.
402
+ Note: when ``locked ``, it's not necessary to specify a ``class_path ``
403
+ or ``template_path ``, but this functionality is deprecated in favour of
404
+ ``external ``.
368
405
**enabled: **
369
406
(optional) If set to false, the stack is disabled, and will not be
370
407
built or updated. This can allow you to disable stacks in different
@@ -383,22 +420,6 @@ A stack has the following keys:
383
420
**tags: **
384
421
(optional) a dictionary of CloudFormation tags to apply to this stack. This
385
422
will be combined with the global tags, but these tags will take precendence.
386
- **stack_name: **
387
- (optional) If provided, this will be used as the name of the CloudFormation
388
- stack. Unlike ``name ``, the value doesn't need to be unique within the config,
389
- since you could have multiple stacks with the same name, but in different
390
- regions or accounts. (note: the namespace from the environment will be
391
- prepended to this)
392
- **region **:
393
- (optional): If provided, specifies the name of the region that the
394
- CloudFormation stack should reside in. If not provided, the default region
395
- will be used (``AWS_DEFAULT_REGION ``, ``~/.aws/config `` or the ``--region ``
396
- flag). If both ``region `` and ``profile `` are specified, the value here takes
397
- precedence over the value in the profile.
398
- **profile **:
399
- (optional): If provided, specifies the name of a AWS profile to use when
400
- performing AWS API calls for this stack. This can be used to provision stacks
401
- in multiple accounts or regions.
402
423
**stack_policy_path **:
403
424
(optional): If provided, specifies the path to a JSON formatted stack policy
404
425
that will be applied when the CloudFormation stack is created and updated.
@@ -411,13 +432,20 @@ A stack has the following keys:
411
432
option to `wait ` and stacker will wait for the previous update to complete
412
433
before attempting to update the stack.
413
434
414
- Stacks Example
415
- ~~~~~~~~~~~~~~
435
+ Examples
436
+ ~~~~~~~~
437
+
438
+ VPC + Instances
439
+ :::::::::::::::
416
440
417
- Here's an example from stacker_blueprints _, used to create a VPC::
441
+ Here's an example from stacker_blueprints _, used to create a VPC and and two EC2
442
+ Instances::
418
443
444
+
445
+ namespace: example
419
446
stacks:
420
- - name: vpc-example
447
+ - name: vpc
448
+ stack_name: test-vpc
421
449
class_path: stacker_blueprints.vpc.VPC
422
450
locked: false
423
451
enabled: true
@@ -438,6 +466,47 @@ Here's an example from stacker_blueprints_, used to create a VPC::
438
466
- 10.128.20.0/22
439
467
CidrBlock: 10.128.0.0/16
440
468
469
+ - name: instances
470
+ stack_name:
471
+ class_path: stacker_blueprints.ec2.Instances
472
+ enabled: true
473
+ variables:
474
+ SmallInstance:
475
+ InstanceType: t2.small
476
+ ImageId: &amazon_linux_ami "${ami owners:amazon name_regex:amzn-ami-hvm-2018.03.*-x86_64-gp2}"
477
+ AvailabilityZone: ${output vpc::AvailabilityZone0}
478
+ SubnetId: ${output vpc::PublicSubnet0}
479
+ LargeInstance:
480
+ InstanceType: m5.xlarge
481
+ ImageId: *amazon_linux_ami
482
+ AvailabilityZone: ${output vpc::AvailabilityZone1}
483
+ SubnetId: ${output vpc::PublicSubnet1}
484
+
485
+
486
+ Referencing External Stacks
487
+ :::::::::::::::::::::::::::
488
+
489
+ This example creates a security group in VPC from the previous example by
490
+ importing it as an external stack with a custom profile::
491
+
492
+ namespace: other-example
493
+ stacks:
494
+ - name: vpc
495
+ fqn: example-test-vpc
496
+ profile: custom-profile
497
+ external: yes
498
+
499
+ - name: sg
500
+ class_path: stacker_blueprints.ec2.SecurityGroups
501
+ variables:
502
+ SecurityGroups:
503
+ VpcId: ${output vpc::VpcId}
504
+ SecurityGroupIngress:
505
+ - CidrIp: 0.0.0.0/0
506
+ FromPort: 22
507
+ ToPort: 22
508
+ IpProtocol: tcp
509
+
441
510
Targets
442
511
-------
443
512
0 commit comments