From a017077120ec2c24acd8fb357cd2645e8c5c5289 Mon Sep 17 00:00:00 2001 From: Justin Wilaby Date: Fri, 10 Jan 2025 11:38:09 -0800 Subject: [PATCH] Updated to differentiate between fir and cedar --- packages/cli/src/commands/spaces/destroy.ts | 31 +++++++------------ .../unit/commands/spaces/destroy.unit.test.ts | 25 ++++++++++----- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/packages/cli/src/commands/spaces/destroy.ts b/packages/cli/src/commands/spaces/destroy.ts index 9e73c9e201..52f5a24922 100644 --- a/packages/cli/src/commands/spaces/destroy.ts +++ b/packages/cli/src/commands/spaces/destroy.ts @@ -45,27 +45,20 @@ export default class Destroy extends Command { if (space.state === 'allocated') { ({body: space.outbound_ips} = await this.heroku.get>(`/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.`)} + ` } } diff --git a/packages/cli/test/unit/commands/spaces/destroy.unit.test.ts b/packages/cli/test/unit/commands/spaces/destroy.unit.test.ts index bd151917a0..bcbbca3fef 100644 --- a/packages/cli/test/unit/commands/spaces/destroy.unit.test.ts +++ b/packages/cli/test/unit/commands/spaces/destroy.unit.test.ts @@ -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 `) @@ -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 `)