Skip to content

Commit

Permalink
Updated to differentiate between fir and cedar
Browse files Browse the repository at this point in the history
  • Loading branch information
justinwilaby committed Jan 10, 2025
1 parent ff20d8e commit a017077
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
31 changes: 12 additions & 19 deletions packages/cli/src/commands/spaces/destroy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,20 @@ export default class Destroy extends Command {
if (space.state === 'allocated') {
({body: space.outbound_ips} = await this.heroku.get<Required<Heroku.SpaceNetworkAddressTranslation>>(`/spaces/${spaceName}/nat`))
if (space.outbound_ips && space.outbound_ips.state === 'enabled') {
if (space.generation?.name === 'fir') {
natWarning = heredoc`
${color.dim('===')} ${color.bold('WARNING: Outbound IPs Will Be Reused')}
${color.yellow('⚠️ The following outbound IPs (IPv4 and IPv6) will become available for reuse:')}
${color.bold(displayNat(space.outbound_ips) ?? '')}
const ipv6 = space.generation?.name === 'fir' ? ' and IPv6' : ''
natWarning = heredoc`
${color.dim('===')} ${color.bold('WARNING: Outbound IPs Will Be Reused')}
${color.yellow(`⚠️ Deleting this space frees up the following outbound IPv4${ipv6} IPs for reuse:`)}
${color.bold(displayNat(space.outbound_ips) ?? '')}
${color.dim('Please update the following configurations:')}
${color.dim('=')} IP allowlists
${color.dim('=')} Firewall rules
${color.dim('=')} Security group configurations
${color.dim('=')} Network ACLs
${color.dim('Update the following configurations:')}
${color.dim('=')} IP allowlists
${color.dim('=')} Firewall rules
${color.dim('=')} Security group configurations
${color.dim('=')} Network ACLs
${color.yellow('Ensure all IPv4 and IPv6 addresses are removed from your security configurations.')}
`
} else {
natWarning = heredoc`
${color.dim('===')} ${color.bold('WARNING: Outbound IPs Will Be Reused')}
${color.yellow('⚠️ The following outbound IPs will become available for reuse:')}
${color.bold(displayNat(space.outbound_ips) ?? '')}
`
}
${color.yellow(`Ensure that you remove the listed IPv4${ipv6} addresses from your security configurations.`)}
`
}
}

Expand Down
25 changes: 17 additions & 8 deletions packages/cli/test/unit/commands/spaces/destroy.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ describe('spaces:destroy', function () {
expect(stderr.output).to.eq(heredoc` › Warning: Destructive Action
› This command will destroy the space my-space
› === WARNING: Outbound IPs Will Be Reused
› ⚠️ The following outbound IPs (IPv4 and IPv6) will become available for
› reuse:
› ⚠️ Deleting this space frees up the following outbound IPv4 and IPv6 IPs
for reuse:
› 1.1.1.1, 2.2.2.2
Please update the following configurations:
Update the following configurations:
› = IP allowlists
› = Firewall rules
› = Security group configurations
› = Network ACLs
› Ensure all IPv4 and IPv6 addresses are removed from your security
› configurations.
› Ensure that you remove the listed IPv4 and IPv6 addresses from your
security configurations.
Destroying space my-space...
Destroying space my-space... done
`)
Expand Down Expand Up @@ -83,11 +83,20 @@ describe('spaces:destroy', function () {
expect(stderr.output).to.eq(heredoc` › Warning: Destructive Action
› This command will destroy the space my-space
› === WARNING: Outbound IPs Will Be Reused
› ⚠️ The following outbound IPs will become available for reuse:
› ⚠️ Deleting this space frees up the following outbound IPv4 IPs for reuse:
› 1.1.1.1, 2.2.2.2
› Update the following configurations:
› = IP allowlists
› = Firewall rules
› = Security group configurations
› = Network ACLs
› Ensure that you remove the listed IPv4 addresses from your security
› configurations.
Destroying space my-space...
Destroying space my-space... done
`)
Expand Down

0 comments on commit a017077

Please sign in to comment.