cfn-compose icon indicating copy to clipboard operation
cfn-compose copied to clipboard

Support resuable configuration snippets options in cfn-compose.yml file

Open rbalman opened this issue 1 year ago • 1 comments

Right now the sample configuration looks sth like shown below where we are not sure if we can make use of defaults and override any specific configuration from individual flow. The scope of the issue is to:

  • find out if it is supported by default with yaml configuration
  • if not see what can we change in our side to include this and propose if it is worth doing or not.
    • if feasible then we should implement the change

Current Status

Description: Demo CloudFormation Compose file
Vars:
  ENV_NAME: demo
  ENV_TYPE: nonproduction
  AWS_PROFILE: demo
Flows:
  DemoSQS:
    Description: Creates Demo SQS Queue
    Stacks:
    - template_file: sqs.yml
      stack_name: demo-{{ .ENV_NAME }}-sqs-queue
      parameters:
        EnvironmentName: '{{ .ENV_NAME }}'
        EnvironmentType: '{{ .ENV_TYPE }}'
      tags:
        EnvironmentName: '{{ .ENV_NAME }}'
        EnvironmentType: '{{ .ENV_TYPE }}'
    Order: 0
  DemoRDSInstance:
    Description: Demo RDS Instance
    Stacks:
    - template_file: rds.yml
      stack_name: demo-{{ .ENV_NAME }}-rds-instance
      parameters:
        EnvironmentName: '{{ .ENV_NAME }}'
        EnvironmentType: '{{ .ENV_TYPE }}'
      tags:
        EnvironmentName: '{{ .ENV_NAME }}'
        EnvironmentType: '{{ .ENV_TYPE }}'
    Order: 0
  DemoEc2Instance:
    Description: Deploy Demo EC2 Instance
    Stacks:
    - template_file: ec2.yml
      stack_name: demo-{{ .ENV_NAME }}-ec2-instance
      parameters:
        EnvironmentName: '{{ .ENV_NAME }}'
        EnvironmentType: '{{ .ENV_TYPE }}'
      tags:
        EnvironmentName: '{{ .ENV_NAME }}'
        EnvironmentType: '{{ .ENV_TYPE }}'
    Order: 1

Expected

Description: Demo CloudFormation Compose file
Vars:
  ENV_NAME: demo
  ENV_TYPE: nonproduction
  AWS_PROFILE: demo

default: &default
  parameters:
    EnvironmentName: '{{ .ENV_NAME }}'
    EnvironmentType: '{{ .ENV_TYPE }}'
  tags:
    EnvironmentName: '{{ .ENV_NAME }}'
    EnvironmentType: '{{ .ENV_TYPE }}'

Flows:
  DemoSQS:
    <<: *default
    Description: Creates Demo SQS Queue
    Stacks:
    - template_file: sqs.yml
      stack_name: demo-{{ .ENV_NAME }}-sqs-queue
    Order: 0
    tags:
      type: "sqs"
  DemoRDSInstance:
    <<: *default
    Description: Demo RDS Instance
    Stacks:
    - template_file: rds.yml
      stack_name: demo-{{ .ENV_NAME }}-rds-instance
    Order: 0
    parameters:
      EngineVersion: '12.4.0'
  DemoEc2Instance:
    <<: *default
    Description: Deploy Demo EC2 Instance
    Stacks:
    - template_file: ec2.yml
      stack_name: demo-{{ .ENV_NAME }}-ec2-instance
    Order: 1

rbalman avatar Dec 19 '22 04:12 rbalman