File tree 2 files changed +8
-8
lines changed
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 3
3
DeleteVpcCommand ,
4
4
DescribeVpcsCommand ,
5
5
EC2Client ,
6
- ResourceNotFoundException ,
6
+ ResourceType ,
7
7
type Tag ,
8
+ type TagSpecification ,
8
9
} from "@aws-sdk/client-ec2" ;
9
10
import type { Context } from "../context" ;
10
11
import { Resource } from "../resource" ;
@@ -219,7 +220,7 @@ export const Vpc = Resource(
219
220
if ( this . phase === "delete" ) {
220
221
try {
221
222
if ( this . output ?. id ) {
222
- await ignore ( ResourceNotFoundException . name , ( ) =>
223
+ await ignore ( "VpcNotFound" , ( ) =>
223
224
client . send (
224
225
new DeleteVpcCommand ( {
225
226
VpcId : this . output . id ,
@@ -235,7 +236,7 @@ export const Vpc = Resource(
235
236
} else {
236
237
try {
237
238
// Format tags for AWS API
238
- const tagSpecifications = [ ] ;
239
+ const tagSpecifications : TagSpecification [ ] = [ ] ;
239
240
const tags : Tag [ ] = [ ] ;
240
241
241
242
if ( props . name ) {
@@ -256,7 +257,7 @@ export const Vpc = Resource(
256
257
257
258
if ( tags . length > 0 ) {
258
259
tagSpecifications . push ( {
259
- ResourceType : " vpc" ,
260
+ ResourceType : ResourceType . vpc ,
260
261
Tags : tags ,
261
262
} ) ;
262
263
}
Original file line number Diff line number Diff line change @@ -74,16 +74,15 @@ describe("Vpc Resource", () => {
74
74
// Check if it's in a terminated state or gone from the response
75
75
if ( getDeletedResponse . Vpcs && getDeletedResponse . Vpcs . length > 0 ) {
76
76
const deletedVpc = getDeletedResponse . Vpcs [ 0 ] ;
77
- expect ( deletedVpc . State ) . toEqual ( "pending-delete" ) ;
77
+ // VPC states are "available" or "pending"
78
+ expect ( deletedVpc . State ) . toEqual ( "pending" ) ;
78
79
} else {
79
80
// VPC was successfully deleted
80
81
expect ( getDeletedResponse . Vpcs ?. length ) . toEqual ( 0 ) ;
81
82
}
82
83
} catch ( error : any ) {
83
84
// The describe call should fail with a not found error
84
- expect ( error . name ) . toMatch (
85
- / V p c N o t F o u n d | I n v a l i d V p c I d | R e s o u r c e N o t F o u n d E x c e p t i o n /
86
- ) ;
85
+ expect ( error . name ) . toMatch ( / V p c N o t F o u n d / ) ;
87
86
}
88
87
}
89
88
}
You can’t perform that action at this time.
0 commit comments