1 | 'use strict'
|
2 |
|
3 | let cli = require('heroku-cli-util')
|
4 | let co = require('co')
|
5 |
|
6 | function displayJSON (info) {
|
7 | cli.log(JSON.stringify(info, null, 2))
|
8 | }
|
9 |
|
10 | function * run (context, heroku) {
|
11 | let lib = require('../../lib/peering')(heroku)
|
12 | let space = context.flags.space || context.args.space
|
13 | if (!space) throw new Error('Space name required.\nUSAGE: heroku spaces:peering:info --space my-space')
|
14 | let pInfo = yield lib.getPeeringInfo(space)
|
15 | if (context.flags.json) displayJSON(pInfo)
|
16 | else lib.displayPeeringInfo(space, pInfo)
|
17 | }
|
18 |
|
19 | module.exports = {
|
20 | topic: 'spaces',
|
21 | command: 'peering:info',
|
22 | description: 'display the information necessary to initiate a peering connection',
|
23 | help: `Example:
|
24 |
|
25 | $ heroku spaces:peering:info example-space
|
26 | === example-space Peering Info
|
27 | AWS Account ID: 012345678910
|
28 | AWS Region: us-west-2
|
29 | AWS VPC ID: vpc-baadf00d
|
30 | AWS VPC CIDR: 10.0.0.0/16
|
31 | Dyno CIDRs: 10.0.128.0/20, 10.0.144.0/20
|
32 | Unavailable CIDRs: 10.1.0.0/16
|
33 |
|
34 | You will use the information provied by this command to establish a peering connection request from your AWS VPC to your private space.
|
35 |
|
36 | To start the peering process, go into your AWS console for the VPC you would like peered with your Private Space,
|
37 | navigate to the VPC service, choose the "Peering Connections" option and click the "Create peering connection" button.
|
38 |
|
39 | - The AWS Account ID and VPC ID are necessary for the AWS VPC Peering connection wizard.
|
40 | - You will also need to configure your VPC route table to route the Dyno CIDRs through the peering connection.
|
41 |
|
42 | Once you've established the peering connection request, you can use the spaces:peerings:accept command to accept and
|
43 | configure the peering connection for the space.
|
44 | `,
|
45 | needsApp: false,
|
46 | needsAuth: true,
|
47 | args: [{name: 'space', optional: true, hidden: true}],
|
48 | flags: [
|
49 | {name: 'space', char: 's', hasValue: true, description: 'space to get peering info from'},
|
50 | {name: 'json', description: 'output in json format'}
|
51 | ],
|
52 | run: cli.command(co.wrap(run))
|
53 | }
|