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

add plugin cfn_output #207

Closed
wants to merge 1 commit into from
Closed

add plugin cfn_output #207

wants to merge 1 commit into from

Conversation

fujiwara
Copy link
Contributor

@fujiwara fujiwara commented Dec 21, 2020

This PR adds cfn_output template function to lookup cloudformation stack's output.

For example,

# config.yaml
# ...
service_definition: service-def.json
plugins:
  - name: cfn_output

aws cloudformationcfn describe-stacks --stack-name EcsSampleStack output.

{
  "Stacks": [
    {
      "StackId": "arn:aws:cloudformation:ap-northeast-1:012345678901:stack/EcsSampleStack/790004d0-42aa-11eb-8fb1-06aa9b7dfc56",
      "StackName": "EcsSampleStack",
      "Outputs": [
        {
          "OutputKey": "Subnet1Output",
          "OutputValue": "subnet-01036767a9c7c3ab8"
        },
        {
          "OutputKey": "SecurityGroupIdOutput",
          "OutputValue": "sg-0aa077022a7a4c54d"
        },
        {
          "OutputKey": "Subnet2Output",
          "OutputValue": "subnet-0890a957951b89645"
        }
      ]
    }
  ]
}

service-def.json

{
  "networkConfiguration": {
    "awsvpcConfiguration": {
      "assignPublicIp": "ENABLED",
      "securityGroups": [
        "{{ cfn_output `EcsSampleStack` `SecurityGroupIdOutput` }}"
      ],
      "subnets": [
        "{{ cfn_output `EcsSampleStack` `Subnet1Output` }}",
        "{{ cfn_output `EcsSampleStack` `Subnet2Output` }}"
      ]
    }
  }
}

ecspreso render --service-definition outputs as below.

{
  "networkConfiguration": {
    "awsvpcConfiguration": {
      "assignPublicIp": "ENABLED",
      "securityGroups": [
        "sg-0aa077022a7a4c54d"
      ],
      "subnets": [
        "subnet-01036767a9c7c3ab8",
        "subnet-0890a957951b89645"
      ]
    }
  }
}

Lookup CFn outputs by stack name and outputKey in templates.
@fujiwara
Copy link
Contributor Author

fujiwara commented Jan 5, 2021

continue in #217.

@fujiwara fujiwara closed this Jan 5, 2021
@fujiwara fujiwara deleted the cfn_output branch January 5, 2021 09:32
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

Successfully merging this pull request may close these issues.

None yet

1 participant