alchemy 0.61.0 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/bin/alchemy.js +1406 -1464
- package/bin/commands/init.ts +29 -2
- package/bin/services/execute-alchemy.ts +1 -2
- package/lib/alchemy.d.ts +2 -2
- package/lib/alchemy.d.ts.map +1 -1
- package/lib/alchemy.js.map +1 -1
- package/lib/aws/client-props.d.ts +149 -0
- package/lib/aws/client-props.d.ts.map +1 -0
- package/lib/aws/client-props.js +1 -0
- package/lib/aws/client-props.js.map +1 -0
- package/lib/aws/credentials.d.ts +68 -5
- package/lib/aws/credentials.d.ts.map +1 -1
- package/lib/aws/credentials.js +148 -0
- package/lib/aws/credentials.js.map +1 -1
- package/lib/aws/ec2/internet-gateway-attachment.d.ts +57 -3
- package/lib/aws/ec2/internet-gateway-attachment.d.ts.map +1 -1
- package/lib/aws/ec2/internet-gateway-attachment.js +57 -3
- package/lib/aws/ec2/internet-gateway-attachment.js.map +1 -1
- package/lib/aws/ec2/internet-gateway.d.ts +68 -40
- package/lib/aws/ec2/internet-gateway.d.ts.map +1 -1
- package/lib/aws/ec2/internet-gateway.js +68 -40
- package/lib/aws/ec2/internet-gateway.js.map +1 -1
- package/lib/aws/ec2/nat-gateway.d.ts +99 -18
- package/lib/aws/ec2/nat-gateway.d.ts.map +1 -1
- package/lib/aws/ec2/nat-gateway.js +113 -37
- package/lib/aws/ec2/nat-gateway.js.map +1 -1
- package/lib/aws/ec2/route-table-association.d.ts +1 -1
- package/lib/aws/ec2/route-table-association.js +1 -1
- package/lib/aws/ec2/route-table.d.ts +64 -1
- package/lib/aws/ec2/route-table.d.ts.map +1 -1
- package/lib/aws/ec2/route-table.js +64 -1
- package/lib/aws/ec2/route-table.js.map +1 -1
- package/lib/aws/ec2/route.d.ts +60 -1
- package/lib/aws/ec2/route.d.ts.map +1 -1
- package/lib/aws/ec2/route.js +60 -1
- package/lib/aws/ec2/route.js.map +1 -1
- package/lib/aws/ec2/security-group.d.ts +96 -3
- package/lib/aws/ec2/security-group.d.ts.map +1 -1
- package/lib/aws/ec2/security-group.js +96 -3
- package/lib/aws/ec2/security-group.js.map +1 -1
- package/lib/aws/ec2/subnet.d.ts +61 -3
- package/lib/aws/ec2/subnet.d.ts.map +1 -1
- package/lib/aws/ec2/subnet.js +61 -3
- package/lib/aws/ec2/subnet.js.map +1 -1
- package/lib/aws/ec2/utils.d.ts +10 -2
- package/lib/aws/ec2/utils.d.ts.map +1 -1
- package/lib/aws/ec2/utils.js +68 -7
- package/lib/aws/ec2/utils.js.map +1 -1
- package/lib/aws/ec2/vpc.d.ts +50 -2
- package/lib/aws/ec2/vpc.d.ts.map +1 -1
- package/lib/aws/ec2/vpc.js +50 -2
- package/lib/aws/ec2/vpc.js.map +1 -1
- package/lib/aws/index.d.ts +2 -0
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +2 -0
- package/lib/aws/index.js.map +1 -1
- package/lib/cloudflare/api-response.js +2 -2
- package/lib/cloudflare/api-response.js.map +1 -1
- package/lib/cloudflare/api.d.ts +19 -0
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +4 -0
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/assets.d.ts.map +1 -1
- package/lib/cloudflare/assets.js +3 -4
- package/lib/cloudflare/assets.js.map +1 -1
- package/lib/cloudflare/bucket.d.ts +5 -3
- package/lib/cloudflare/bucket.d.ts.map +1 -1
- package/lib/cloudflare/bucket.js +22 -18
- package/lib/cloudflare/bucket.js.map +1 -1
- package/lib/cloudflare/bundle/plugin-compat-warning.js +7 -7
- package/lib/cloudflare/bundle/plugin-compat-warning.js.map +1 -1
- package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
- package/lib/cloudflare/kv-namespace.d.ts +2 -2
- package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
- package/lib/cloudflare/kv-namespace.js.map +1 -1
- package/lib/cloudflare/oauth.js +3 -3
- package/lib/cloudflare/oauth.js.map +1 -1
- package/lib/cloudflare/quick-tunnel.d.ts +1 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +26 -97
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-bundle.d.ts.map +1 -1
- package/lib/cloudflare/worker-bundle.js +9 -8
- package/lib/cloudflare/worker-bundle.js.map +1 -1
- package/lib/cloudflare/worker-tail.d.ts.map +1 -1
- package/lib/cloudflare/worker-tail.js +6 -6
- package/lib/cloudflare/worker-tail.js.map +1 -1
- package/lib/resource.d.ts +1 -0
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js +13 -2
- package/lib/resource.js.map +1 -1
- package/lib/scope.d.ts +24 -23
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +25 -20
- package/lib/scope.js.map +1 -1
- package/lib/state/cloudflare-state-store.d.ts.map +1 -1
- package/lib/state/cloudflare-state-store.js +2 -1
- package/lib/state/cloudflare-state-store.js.map +1 -1
- package/lib/util/idempotent-spawn.d.ts +10 -8
- package/lib/util/idempotent-spawn.d.ts.map +1 -1
- package/lib/util/idempotent-spawn.js +97 -78
- package/lib/util/idempotent-spawn.js.map +1 -1
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +2 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/safe-fetch.d.ts +24 -0
- package/lib/util/safe-fetch.d.ts.map +1 -1
- package/lib/util/safe-fetch.js +72 -0
- package/lib/util/safe-fetch.js.map +1 -1
- package/package.json +8 -5
- package/src/alchemy.ts +2 -2
- package/src/aws/client-props.ts +156 -0
- package/src/aws/credentials.ts +165 -4
- package/src/aws/ec2/internet-gateway-attachment.ts +59 -4
- package/src/aws/ec2/internet-gateway.ts +70 -41
- package/src/aws/ec2/nat-gateway.ts +123 -33
- package/src/aws/ec2/route-table-association.ts +1 -1
- package/src/aws/ec2/route-table.ts +66 -2
- package/src/aws/ec2/route.ts +62 -2
- package/src/aws/ec2/security-group.ts +98 -4
- package/src/aws/ec2/subnet.ts +63 -4
- package/src/aws/ec2/utils.ts +73 -7
- package/src/aws/ec2/vpc.ts +52 -3
- package/src/aws/index.ts +2 -0
- package/src/cloudflare/api-response.ts +2 -2
- package/src/cloudflare/api.ts +23 -0
- package/src/cloudflare/assets.ts +3 -4
- package/src/cloudflare/bucket.ts +27 -25
- package/src/cloudflare/bundle/plugin-compat-warning.ts +7 -7
- package/src/cloudflare/cloudflare-env-proxy.ts +2 -2
- package/src/cloudflare/kv-namespace.ts +26 -27
- package/src/cloudflare/oauth.ts +3 -3
- package/src/cloudflare/website.ts +30 -111
- package/src/cloudflare/worker-bundle.ts +9 -8
- package/src/cloudflare/worker-tail.ts +6 -8
- package/src/resource.ts +19 -2
- package/src/scope.ts +73 -43
- package/src/state/cloudflare-state-store.ts +2 -1
- package/src/util/idempotent-spawn.ts +117 -100
- package/src/util/index.ts +1 -0
- package/src/util/safe-fetch.ts +114 -0
package/lib/aws/ec2/route.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Context } from "../../context.ts";
|
|
2
2
|
import { Resource } from "../../resource.ts";
|
|
3
3
|
import { type TimeoutConfig } from "../../util/timeout.ts";
|
|
4
|
+
import type { AwsClientProps } from "../client-props.ts";
|
|
4
5
|
import type { InternetGateway } from "./internet-gateway.ts";
|
|
5
6
|
import type { NatGateway } from "./nat-gateway.ts";
|
|
6
7
|
import type { RouteTable } from "./route-table.ts";
|
|
7
8
|
/**
|
|
8
9
|
* Properties for creating or updating a Route
|
|
9
10
|
*/
|
|
10
|
-
export interface RouteProps {
|
|
11
|
+
export interface RouteProps extends AwsClientProps {
|
|
11
12
|
/**
|
|
12
13
|
* The route table to add the route to
|
|
13
14
|
*/
|
|
@@ -62,6 +63,9 @@ export interface Route extends Resource<"aws::Route">, RouteProps {
|
|
|
62
63
|
* Creates and manages individual routes within route tables, directing traffic
|
|
63
64
|
* to various targets like Internet Gateways, NAT Gateways, or instances.
|
|
64
65
|
*
|
|
66
|
+
* Supports AWS credential overrides at the resource level, allowing you to deploy Routes
|
|
67
|
+
* to different AWS accounts or regions than the default scope configuration.
|
|
68
|
+
*
|
|
65
69
|
* @example
|
|
66
70
|
* // Create a default route to Internet Gateway
|
|
67
71
|
* const publicRoute = await Route("public-default-route", {
|
|
@@ -79,6 +83,39 @@ export interface Route extends Resource<"aws::Route">, RouteProps {
|
|
|
79
83
|
* });
|
|
80
84
|
*
|
|
81
85
|
* @example
|
|
86
|
+
* // Create Route with AWS credential overrides
|
|
87
|
+
* const crossAccountRoute = await Route("cross-account-route", {
|
|
88
|
+
* routeTable: mainRouteTable,
|
|
89
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
90
|
+
* target: { internetGateway: mainIgw },
|
|
91
|
+
* // Override AWS credentials for this specific resource
|
|
92
|
+
* region: "us-east-1",
|
|
93
|
+
* profile: "production-account",
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Create Route in different region with role assumption
|
|
98
|
+
* const multiRegionRoute = await Route("multi-region-route", {
|
|
99
|
+
* routeTable: euRouteTable,
|
|
100
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
101
|
+
* target: { internetGateway: euIgw },
|
|
102
|
+
* region: "eu-west-1",
|
|
103
|
+
* roleArn: "arn:aws:iam::123456789012:role/CrossRegionRole",
|
|
104
|
+
* roleSessionName: "route-deployment",
|
|
105
|
+
* });
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* // Create Route with explicit credentials
|
|
109
|
+
* const explicitCredsRoute = await Route("explicit-creds-route", {
|
|
110
|
+
* routeTable: testRouteTable,
|
|
111
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
112
|
+
* target: { internetGateway: testIgw },
|
|
113
|
+
* accessKeyId: alchemy.secret("AKIAIOSFODNN7EXAMPLE"),
|
|
114
|
+
* secretAccessKey: alchemy.secret("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
|
|
115
|
+
* region: "us-west-2",
|
|
116
|
+
* });
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
82
119
|
* // Create a route to a specific instance
|
|
83
120
|
* const instanceRoute = await Route("instance-route", {
|
|
84
121
|
* routeTable: "rtb-12345678",
|
|
@@ -121,6 +158,28 @@ export interface Route extends Resource<"aws::Route">, RouteProps {
|
|
|
121
158
|
* delayMs: 2000
|
|
122
159
|
* }
|
|
123
160
|
* });
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* // Multi-account deployment with scope-level and resource-level overrides
|
|
164
|
+
* await alchemy.run("production", {
|
|
165
|
+
* aws: { region: "us-west-2", profile: "main-account" }
|
|
166
|
+
* }, async () => {
|
|
167
|
+
* // This Route uses scope credentials (main-account, us-west-2)
|
|
168
|
+
* const mainRoute = await Route("main-route", {
|
|
169
|
+
* routeTable: mainRouteTable,
|
|
170
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
171
|
+
* target: { internetGateway: mainIgw }
|
|
172
|
+
* });
|
|
173
|
+
*
|
|
174
|
+
* // This Route overrides to use different account
|
|
175
|
+
* const crossAccountRoute = await Route("cross-account-route", {
|
|
176
|
+
* routeTable: crossRouteTable,
|
|
177
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
178
|
+
* target: { internetGateway: crossIgw },
|
|
179
|
+
* profile: "secondary-account",
|
|
180
|
+
* region: "us-east-1", // Also override region
|
|
181
|
+
* });
|
|
182
|
+
* });
|
|
124
183
|
*/
|
|
125
184
|
export declare const Route: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<Route>, _id: string, props: RouteProps) => Promise<Route>);
|
|
126
185
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/route.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,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E,UAAU;IAC/D;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,KAAK,EAAE,QAAQ,GAAG,WAAW,CAAC;IAE9B;;OAEG;IACH,MAAM,EAAE,kBAAkB,GAAG,aAAa,GAAG,2BAA2B,CAAC;CAC1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2HG;AACH,eAAO,MAAM,KAAK,yFAGR,OAAO,CAAC,KAAK,CAAC,OACf,MAAM,SACJ,UAAU,KAChB,OAAO,CAAC,KAAK,CAAC,CAiJlB,CAAC;AAuDF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
|
package/lib/aws/ec2/route.js
CHANGED
|
@@ -11,6 +11,9 @@ import { callEC2Api, createEC2Client } from "./utils.js";
|
|
|
11
11
|
* Creates and manages individual routes within route tables, directing traffic
|
|
12
12
|
* to various targets like Internet Gateways, NAT Gateways, or instances.
|
|
13
13
|
*
|
|
14
|
+
* Supports AWS credential overrides at the resource level, allowing you to deploy Routes
|
|
15
|
+
* to different AWS accounts or regions than the default scope configuration.
|
|
16
|
+
*
|
|
14
17
|
* @example
|
|
15
18
|
* // Create a default route to Internet Gateway
|
|
16
19
|
* const publicRoute = await Route("public-default-route", {
|
|
@@ -28,6 +31,39 @@ import { callEC2Api, createEC2Client } from "./utils.js";
|
|
|
28
31
|
* });
|
|
29
32
|
*
|
|
30
33
|
* @example
|
|
34
|
+
* // Create Route with AWS credential overrides
|
|
35
|
+
* const crossAccountRoute = await Route("cross-account-route", {
|
|
36
|
+
* routeTable: mainRouteTable,
|
|
37
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
38
|
+
* target: { internetGateway: mainIgw },
|
|
39
|
+
* // Override AWS credentials for this specific resource
|
|
40
|
+
* region: "us-east-1",
|
|
41
|
+
* profile: "production-account",
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Create Route in different region with role assumption
|
|
46
|
+
* const multiRegionRoute = await Route("multi-region-route", {
|
|
47
|
+
* routeTable: euRouteTable,
|
|
48
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
49
|
+
* target: { internetGateway: euIgw },
|
|
50
|
+
* region: "eu-west-1",
|
|
51
|
+
* roleArn: "arn:aws:iam::123456789012:role/CrossRegionRole",
|
|
52
|
+
* roleSessionName: "route-deployment",
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // Create Route with explicit credentials
|
|
57
|
+
* const explicitCredsRoute = await Route("explicit-creds-route", {
|
|
58
|
+
* routeTable: testRouteTable,
|
|
59
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
60
|
+
* target: { internetGateway: testIgw },
|
|
61
|
+
* accessKeyId: alchemy.secret("AKIAIOSFODNN7EXAMPLE"),
|
|
62
|
+
* secretAccessKey: alchemy.secret("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
|
|
63
|
+
* region: "us-west-2",
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
31
67
|
* // Create a route to a specific instance
|
|
32
68
|
* const instanceRoute = await Route("instance-route", {
|
|
33
69
|
* routeTable: "rtb-12345678",
|
|
@@ -70,9 +106,32 @@ import { callEC2Api, createEC2Client } from "./utils.js";
|
|
|
70
106
|
* delayMs: 2000
|
|
71
107
|
* }
|
|
72
108
|
* });
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* // Multi-account deployment with scope-level and resource-level overrides
|
|
112
|
+
* await alchemy.run("production", {
|
|
113
|
+
* aws: { region: "us-west-2", profile: "main-account" }
|
|
114
|
+
* }, async () => {
|
|
115
|
+
* // This Route uses scope credentials (main-account, us-west-2)
|
|
116
|
+
* const mainRoute = await Route("main-route", {
|
|
117
|
+
* routeTable: mainRouteTable,
|
|
118
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
119
|
+
* target: { internetGateway: mainIgw }
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* // This Route overrides to use different account
|
|
123
|
+
* const crossAccountRoute = await Route("cross-account-route", {
|
|
124
|
+
* routeTable: crossRouteTable,
|
|
125
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
126
|
+
* target: { internetGateway: crossIgw },
|
|
127
|
+
* profile: "secondary-account",
|
|
128
|
+
* region: "us-east-1", // Also override region
|
|
129
|
+
* });
|
|
130
|
+
* });
|
|
73
131
|
*/
|
|
74
132
|
export const Route = Resource("aws::Route", async function (_id, props) {
|
|
75
|
-
|
|
133
|
+
// Create EC2 client with credential resolution handled internally
|
|
134
|
+
const client = await createEC2Client(props);
|
|
76
135
|
const _timeoutConfig = mergeTimeoutConfig(ROUTE_TIMEOUT, props.timeout);
|
|
77
136
|
const routeTableId = typeof props.routeTable === "string"
|
|
78
137
|
? props.routeTable
|
package/lib/aws/ec2/route.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/aws/ec2/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAElB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/aws/ec2/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,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YACN,MAAM,CAAC,WAAW,GAAG,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,2BAA2B;IAC3B,IACE,MAAM,CAAC,mBAAmB;QAC1B,MAAM,CAAC,oBAAoB;QAC3B,MAAM,CAAC,mBAAmB,EAC1B,CAAC;QACD,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context } from "../../context.ts";
|
|
2
2
|
import { Resource } from "../../resource.ts";
|
|
3
3
|
import { type TimeoutConfig } from "../../util/timeout.ts";
|
|
4
|
+
import type { AwsClientProps } from "../client-props.ts";
|
|
4
5
|
import type { Vpc } from "./vpc.ts";
|
|
5
6
|
/**
|
|
6
7
|
* Security Group timeout constants
|
|
@@ -9,7 +10,7 @@ export declare const SECURITY_GROUP_TIMEOUT: TimeoutConfig;
|
|
|
9
10
|
/**
|
|
10
11
|
* Properties for creating or updating a Security Group
|
|
11
12
|
*/
|
|
12
|
-
export interface SecurityGroupProps {
|
|
13
|
+
export interface SecurityGroupProps extends AwsClientProps {
|
|
13
14
|
/**
|
|
14
15
|
* The VPC to create the security group in.
|
|
15
16
|
*/
|
|
@@ -56,8 +57,12 @@ export interface SecurityGroup extends Resource<"aws::SecurityGroup">, SecurityG
|
|
|
56
57
|
* instances and other AWS resources. Rules are managed separately using the
|
|
57
58
|
* `SecurityGroupRule` resource.
|
|
58
59
|
*
|
|
60
|
+
* Supports AWS credential overrides at the resource level, allowing you to deploy Security Groups
|
|
61
|
+
* to different AWS accounts or regions than the default scope configuration.
|
|
62
|
+
*
|
|
59
63
|
* @example
|
|
60
|
-
*
|
|
64
|
+
* ```typescript
|
|
65
|
+
* // Create a basic web server security group
|
|
61
66
|
* const webSecurityGroup = await SecurityGroup("web-sg", {
|
|
62
67
|
* vpc: mainVpc,
|
|
63
68
|
* groupName: "web-server-sg",
|
|
@@ -67,11 +72,72 @@ export interface SecurityGroup extends Resource<"aws::SecurityGroup">, SecurityG
|
|
|
67
72
|
* Environment: "production"
|
|
68
73
|
* }
|
|
69
74
|
* });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* // Create Security Group with AWS credential overrides
|
|
80
|
+
* const crossAccountSg = await SecurityGroup("cross-account-sg", {
|
|
81
|
+
* vpc: mainVpc,
|
|
82
|
+
* groupName: "cross-account-security-group",
|
|
83
|
+
* description: "Security group in different account",
|
|
84
|
+
* // Override AWS credentials for this specific resource
|
|
85
|
+
* region: "us-east-1",
|
|
86
|
+
* profile: "production-account",
|
|
87
|
+
* tags: {
|
|
88
|
+
* Name: "cross-account-sg",
|
|
89
|
+
* Environment: "production"
|
|
90
|
+
* }
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
70
93
|
*
|
|
71
94
|
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* // Create Security Group in different region with role assumption
|
|
97
|
+
* const multiRegionSg = await SecurityGroup("multi-region-sg", {
|
|
98
|
+
* vpc: euVpc,
|
|
99
|
+
* groupName: "eu-security-group",
|
|
100
|
+
* description: "Security group in EU region",
|
|
101
|
+
* region: "eu-west-1",
|
|
102
|
+
* roleArn: "arn:aws:iam::123456789012:role/CrossRegionRole",
|
|
103
|
+
* roleSessionName: "security-group-deployment",
|
|
104
|
+
* tags: {
|
|
105
|
+
* Name: "eu-security-group",
|
|
106
|
+
* Region: "europe"
|
|
107
|
+
* }
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* // Create Security Group with explicit credentials
|
|
114
|
+
* const explicitCredsSg = await SecurityGroup("explicit-creds-sg", {
|
|
115
|
+
* vpc: testVpc,
|
|
116
|
+
* groupName: "test-security-group",
|
|
117
|
+
* description: "Security group with explicit credentials",
|
|
118
|
+
* accessKeyId: alchemy.secret("AKIAIOSFODNN7EXAMPLE"),
|
|
119
|
+
* secretAccessKey: alchemy.secret("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
|
|
120
|
+
* region: "us-west-2",
|
|
121
|
+
* tags: {
|
|
122
|
+
* Name: "explicit-credentials-sg",
|
|
123
|
+
* Purpose: "testing"
|
|
124
|
+
* }
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* // Create Security Group with rules (rules managed separately)
|
|
131
|
+
* const webSg = await SecurityGroup("web-sg", {
|
|
132
|
+
* vpc: mainVpc,
|
|
133
|
+
* groupName: "web-server-sg",
|
|
134
|
+
* description: "Security group for web servers",
|
|
135
|
+
* tags: { Name: "web-server-security-group" }
|
|
136
|
+
* });
|
|
137
|
+
*
|
|
72
138
|
* // Separately, define a rule to allow HTTP traffic
|
|
73
139
|
* const httpRule = await SecurityGroupRule("web-sg-http-rule", {
|
|
74
|
-
* securityGroup:
|
|
140
|
+
* securityGroup: webSg,
|
|
75
141
|
* type: "ingress",
|
|
76
142
|
* protocol: "tcp",
|
|
77
143
|
* fromPort: 80,
|
|
@@ -79,6 +145,33 @@ export interface SecurityGroup extends Resource<"aws::SecurityGroup">, SecurityG
|
|
|
79
145
|
* cidrBlocks: ["0.0.0.0/0"],
|
|
80
146
|
* description: "Allow HTTP access from anywhere"
|
|
81
147
|
* });
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* // Multi-account deployment with scope-level and resource-level overrides
|
|
153
|
+
* await alchemy.run("production", {
|
|
154
|
+
* aws: { region: "us-west-2", profile: "main-account" }
|
|
155
|
+
* }, async () => {
|
|
156
|
+
* // This SG uses scope credentials (main-account, us-west-2)
|
|
157
|
+
* const mainSg = await SecurityGroup("main-sg", {
|
|
158
|
+
* vpc: mainVpc,
|
|
159
|
+
* groupName: "main-account-sg",
|
|
160
|
+
* description: "Security group in main account",
|
|
161
|
+
* tags: { Name: "main-account-sg" }
|
|
162
|
+
* });
|
|
163
|
+
*
|
|
164
|
+
* // This SG overrides to use different account
|
|
165
|
+
* const crossAccountSg = await SecurityGroup("cross-account-sg", {
|
|
166
|
+
* vpc: crossVpc,
|
|
167
|
+
* groupName: "secondary-account-sg",
|
|
168
|
+
* description: "Security group in secondary account",
|
|
169
|
+
* profile: "secondary-account",
|
|
170
|
+
* region: "us-east-1", // Also override region
|
|
171
|
+
* tags: { Name: "secondary-account-sg" }
|
|
172
|
+
* });
|
|
173
|
+
* });
|
|
174
|
+
* ```
|
|
82
175
|
*/
|
|
83
176
|
export declare const SecurityGroup: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<SecurityGroup>, _id: string, props: SecurityGroupProps) => Promise<SecurityGroup>);
|
|
84
177
|
//# sourceMappingURL=security-group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-group.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/security-group.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"security-group.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/security-group.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD;;OAEG;IACH,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,aACf,SAAQ,QAAQ,CAAC,oBAAoB,CAAC,EACpC,kBAAkB;IACpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0HG;AACH,eAAO,MAAM,aAAa,yFAGhB,OAAO,CAAC,aAAa,CAAC,OACvB,MAAM,SACJ,kBAAkB,KACxB,OAAO,CAAC,aAAa,CAAC,CAqH1B,CAAC"}
|
|
@@ -17,8 +17,12 @@ export const SECURITY_GROUP_TIMEOUT = {
|
|
|
17
17
|
* instances and other AWS resources. Rules are managed separately using the
|
|
18
18
|
* `SecurityGroupRule` resource.
|
|
19
19
|
*
|
|
20
|
+
* Supports AWS credential overrides at the resource level, allowing you to deploy Security Groups
|
|
21
|
+
* to different AWS accounts or regions than the default scope configuration.
|
|
22
|
+
*
|
|
20
23
|
* @example
|
|
21
|
-
*
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Create a basic web server security group
|
|
22
26
|
* const webSecurityGroup = await SecurityGroup("web-sg", {
|
|
23
27
|
* vpc: mainVpc,
|
|
24
28
|
* groupName: "web-server-sg",
|
|
@@ -28,11 +32,72 @@ export const SECURITY_GROUP_TIMEOUT = {
|
|
|
28
32
|
* Environment: "production"
|
|
29
33
|
* }
|
|
30
34
|
* });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* // Create Security Group with AWS credential overrides
|
|
40
|
+
* const crossAccountSg = await SecurityGroup("cross-account-sg", {
|
|
41
|
+
* vpc: mainVpc,
|
|
42
|
+
* groupName: "cross-account-security-group",
|
|
43
|
+
* description: "Security group in different account",
|
|
44
|
+
* // Override AWS credentials for this specific resource
|
|
45
|
+
* region: "us-east-1",
|
|
46
|
+
* profile: "production-account",
|
|
47
|
+
* tags: {
|
|
48
|
+
* Name: "cross-account-sg",
|
|
49
|
+
* Environment: "production"
|
|
50
|
+
* }
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
31
53
|
*
|
|
32
54
|
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* // Create Security Group in different region with role assumption
|
|
57
|
+
* const multiRegionSg = await SecurityGroup("multi-region-sg", {
|
|
58
|
+
* vpc: euVpc,
|
|
59
|
+
* groupName: "eu-security-group",
|
|
60
|
+
* description: "Security group in EU region",
|
|
61
|
+
* region: "eu-west-1",
|
|
62
|
+
* roleArn: "arn:aws:iam::123456789012:role/CrossRegionRole",
|
|
63
|
+
* roleSessionName: "security-group-deployment",
|
|
64
|
+
* tags: {
|
|
65
|
+
* Name: "eu-security-group",
|
|
66
|
+
* Region: "europe"
|
|
67
|
+
* }
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* // Create Security Group with explicit credentials
|
|
74
|
+
* const explicitCredsSg = await SecurityGroup("explicit-creds-sg", {
|
|
75
|
+
* vpc: testVpc,
|
|
76
|
+
* groupName: "test-security-group",
|
|
77
|
+
* description: "Security group with explicit credentials",
|
|
78
|
+
* accessKeyId: alchemy.secret("AKIAIOSFODNN7EXAMPLE"),
|
|
79
|
+
* secretAccessKey: alchemy.secret("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
|
|
80
|
+
* region: "us-west-2",
|
|
81
|
+
* tags: {
|
|
82
|
+
* Name: "explicit-credentials-sg",
|
|
83
|
+
* Purpose: "testing"
|
|
84
|
+
* }
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* // Create Security Group with rules (rules managed separately)
|
|
91
|
+
* const webSg = await SecurityGroup("web-sg", {
|
|
92
|
+
* vpc: mainVpc,
|
|
93
|
+
* groupName: "web-server-sg",
|
|
94
|
+
* description: "Security group for web servers",
|
|
95
|
+
* tags: { Name: "web-server-security-group" }
|
|
96
|
+
* });
|
|
97
|
+
*
|
|
33
98
|
* // Separately, define a rule to allow HTTP traffic
|
|
34
99
|
* const httpRule = await SecurityGroupRule("web-sg-http-rule", {
|
|
35
|
-
* securityGroup:
|
|
100
|
+
* securityGroup: webSg,
|
|
36
101
|
* type: "ingress",
|
|
37
102
|
* protocol: "tcp",
|
|
38
103
|
* fromPort: 80,
|
|
@@ -40,9 +105,37 @@ export const SECURITY_GROUP_TIMEOUT = {
|
|
|
40
105
|
* cidrBlocks: ["0.0.0.0/0"],
|
|
41
106
|
* description: "Allow HTTP access from anywhere"
|
|
42
107
|
* });
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* // Multi-account deployment with scope-level and resource-level overrides
|
|
113
|
+
* await alchemy.run("production", {
|
|
114
|
+
* aws: { region: "us-west-2", profile: "main-account" }
|
|
115
|
+
* }, async () => {
|
|
116
|
+
* // This SG uses scope credentials (main-account, us-west-2)
|
|
117
|
+
* const mainSg = await SecurityGroup("main-sg", {
|
|
118
|
+
* vpc: mainVpc,
|
|
119
|
+
* groupName: "main-account-sg",
|
|
120
|
+
* description: "Security group in main account",
|
|
121
|
+
* tags: { Name: "main-account-sg" }
|
|
122
|
+
* });
|
|
123
|
+
*
|
|
124
|
+
* // This SG overrides to use different account
|
|
125
|
+
* const crossAccountSg = await SecurityGroup("cross-account-sg", {
|
|
126
|
+
* vpc: crossVpc,
|
|
127
|
+
* groupName: "secondary-account-sg",
|
|
128
|
+
* description: "Security group in secondary account",
|
|
129
|
+
* profile: "secondary-account",
|
|
130
|
+
* region: "us-east-1", // Also override region
|
|
131
|
+
* tags: { Name: "secondary-account-sg" }
|
|
132
|
+
* });
|
|
133
|
+
* });
|
|
134
|
+
* ```
|
|
43
135
|
*/
|
|
44
136
|
export const SecurityGroup = Resource("aws::SecurityGroup", async function (_id, props) {
|
|
45
|
-
|
|
137
|
+
// Create EC2 client with credential resolution handled internally
|
|
138
|
+
const client = await createEC2Client(props);
|
|
46
139
|
const vpcId = typeof props.vpc === "string" ? props.vpc : props.vpc.vpcId;
|
|
47
140
|
const timeoutConfig = mergeTimeoutConfig(SECURITY_GROUP_TIMEOUT, props.timeout);
|
|
48
141
|
if (this.phase === "delete") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-group.js","sourceRoot":"","sources":["../../../src/aws/ec2/security-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAElB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"security-group.js","sourceRoot":"","sources":["../../../src/aws/ec2/security-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EA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aAAa,EACb,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EACZ,aAAa,EACb,OAAO,EACP,gBAAgB,EAChB,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,2BAA2B,CACxC,MAAiB,EACjB,OAAe,EACf,aAA4B;IAE5B,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;QAC/B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAC/B,MAAM,EACN,wBAAwB,EACxB,6BAA6B,EAC7B,EAAE,WAAW,EAAE,OAAO,EAAE,CACzB,CAAC;YACF,OAAO,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,KAAK,CAAC,IAAI,KAAK,uBAAuB,EAAE,CAAC;gBAC3C,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,oBAAoB,CACxB,aAAa,EACb,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EACX,aAAa,EACb,OAAO,EACP,gBAAgB,EAChB,eAAe,CAChB,CAAC;AACJ,CAAC"}
|
package/lib/aws/ec2/subnet.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Context } from "../../context.ts";
|
|
2
2
|
import { Resource } from "../../resource.ts";
|
|
3
3
|
import { type TimeoutConfig } from "../../util/timeout.ts";
|
|
4
|
+
import type { AwsClientProps } from "../client-props.ts";
|
|
4
5
|
import type { Vpc } from "./vpc.ts";
|
|
5
6
|
/**
|
|
6
7
|
* Properties for creating or updating a Subnet
|
|
7
8
|
*/
|
|
8
|
-
export interface SubnetProps {
|
|
9
|
+
export interface SubnetProps extends AwsClientProps {
|
|
9
10
|
/**
|
|
10
11
|
* The VPC to create the subnet in
|
|
11
12
|
*/
|
|
@@ -62,14 +63,15 @@ export interface Subnet extends Resource<"aws::Subnet">, SubnetProps {
|
|
|
62
63
|
* AWS Subnet Resource
|
|
63
64
|
*
|
|
64
65
|
* Creates and manages subnets within a VPC. Subnets are used to segment
|
|
65
|
-
* your VPC into smaller networks for organizing resources.
|
|
66
|
+
* your VPC into smaller networks for organizing resources. Supports AWS
|
|
67
|
+
* credential overrides for multi-account and cross-region deployments.
|
|
66
68
|
*
|
|
67
69
|
* @example
|
|
68
70
|
* // Create a public subnet for web servers
|
|
69
71
|
* const publicSubnet = await Subnet("public-subnet", {
|
|
70
72
|
* vpc: myVpc,
|
|
71
73
|
* cidrBlock: "10.0.1.0/24",
|
|
72
|
-
* availabilityZone:
|
|
74
|
+
* availabilityZone: `${process.env.AWS_REGION}a` || "us-east-1a",
|
|
73
75
|
* mapPublicIpOnLaunch: true,
|
|
74
76
|
* tags: {
|
|
75
77
|
* Name: "public-subnet",
|
|
@@ -101,6 +103,62 @@ export interface Subnet extends Resource<"aws::Subnet">, SubnetProps {
|
|
|
101
103
|
* delayMs: 500
|
|
102
104
|
* }
|
|
103
105
|
* });
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* // Create a subnet with AWS credential overrides for cross-account deployment
|
|
109
|
+
* const crossAccountSubnet = await Subnet("cross-account-subnet", {
|
|
110
|
+
* vpc: myVpc,
|
|
111
|
+
* cidrBlock: "10.1.1.0/24",
|
|
112
|
+
* availabilityZone: "us-east-1a",
|
|
113
|
+
* region: "us-east-1",
|
|
114
|
+
* profile: "production-account",
|
|
115
|
+
* mapPublicIpOnLaunch: true,
|
|
116
|
+
* tags: {
|
|
117
|
+
* Name: "cross-account-subnet",
|
|
118
|
+
* Account: "production"
|
|
119
|
+
* }
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* // Create a subnet in a different region with explicit credentials
|
|
124
|
+
* const multiRegionSubnet = await Subnet("multi-region-subnet", {
|
|
125
|
+
* vpc: "vpc-12345678", // VPC ID from different region
|
|
126
|
+
* cidrBlock: "10.2.1.0/24",
|
|
127
|
+
* availabilityZone: "eu-west-1a",
|
|
128
|
+
* region: "eu-west-1",
|
|
129
|
+
* accessKeyId: alchemy.secret("AKIA..."),
|
|
130
|
+
* secretAccessKey: alchemy.secret("..."),
|
|
131
|
+
* mapPublicIpOnLaunch: false,
|
|
132
|
+
* tags: {
|
|
133
|
+
* Name: "eu-subnet",
|
|
134
|
+
* Region: "europe"
|
|
135
|
+
* }
|
|
136
|
+
* });
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* // Using scope-level credentials with resource-level overrides
|
|
140
|
+
* await alchemy.run("multi-account", {
|
|
141
|
+
* aws: {
|
|
142
|
+
* region: "us-west-2",
|
|
143
|
+
* profile: "staging"
|
|
144
|
+
* }
|
|
145
|
+
* }, async () => {
|
|
146
|
+
* // This subnet uses staging credentials from scope
|
|
147
|
+
* const stagingSubnet = await Subnet("staging-subnet", {
|
|
148
|
+
* vpc: stagingVpc,
|
|
149
|
+
* cidrBlock: "10.0.1.0/24",
|
|
150
|
+
* availabilityZone: "us-west-2a"
|
|
151
|
+
* });
|
|
152
|
+
*
|
|
153
|
+
* // This subnet overrides to use production credentials
|
|
154
|
+
* const prodSubnet = await Subnet("prod-subnet", {
|
|
155
|
+
* vpc: prodVpc,
|
|
156
|
+
* cidrBlock: "10.1.1.0/24",
|
|
157
|
+
* availabilityZone: "us-east-1a",
|
|
158
|
+
* profile: "production",
|
|
159
|
+
* region: "us-east-1"
|
|
160
|
+
* });
|
|
161
|
+
* });
|
|
104
162
|
*/
|
|
105
163
|
export declare const Subnet: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<Subnet>, _id: string, props: SubnetProps) => Promise<Subnet>);
|
|
106
164
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subnet.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/subnet.ts"],"names":[],"mappings":"AAEA,OAAO,KAA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