@fjall/components-infrastructure 40.1.0 → 40.2.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.
|
@@ -6,7 +6,8 @@ export interface ScpPresetProps {
|
|
|
6
6
|
* organisation deploys to (`organisationDeployRegions`) from the org config
|
|
7
7
|
* Fjall passes at synth, plus us-east-1, so with no primary region set it
|
|
8
8
|
* allows the region the cascade deploys as. Unset with an org config that
|
|
9
|
-
* names
|
|
9
|
+
* names only blank regions, it is the list 40.1.0 rendered, with a warning.
|
|
10
|
+
* Unset with one that names no region at all, the synth is refused.
|
|
10
11
|
*/
|
|
11
12
|
allowedRegions?: string[];
|
|
12
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CDK_EXEC_ROLE_ARN_PATTERN, DEPLOY_ROLE_ARN_PATTERN, anyPartitionArnPattern } from "@fjall/generator";
|
|
2
|
-
import { CDK_CONTEXT_KEYS, COST_CONTROL_CLASSES, deriveRegionsFromOrgConfig, isAnyPartitionRegionCodeShape, organisationDeployRegions, removedPropsOf } from "@fjall/util";
|
|
2
|
+
import { CDK_CONTEXT_KEYS, COST_CONTROL_CLASSES, DEFAULT_REGION, cascadePrimaryRegion, deriveRegionsFromOrgConfig, isAnyPartitionRegionCodeShape, organisationDeployRegions, removedPropsOf } from "@fjall/util";
|
|
3
3
|
import { OPERATOR_TAG_KEY_PATTERN } from "@fjall/util/aws";
|
|
4
4
|
import { Annotations } from "aws-cdk-lib";
|
|
5
5
|
import { Construct } from "constructs";
|
|
@@ -9,7 +9,7 @@ import { refuseRemovedProps } from "../../terminology/refuseRemoved.js";
|
|
|
9
9
|
import { parseOrgConfig } from "../../utils/orgConfigParser.js";
|
|
10
10
|
import { S3_BPA_MANAGER_ROLE_NAME, S3_BPA_MANAGER_ROLE_PATH } from "./s3BlockPublicAccess.js";
|
|
11
11
|
const US_EAST_1 = "us-east-1";
|
|
12
|
-
const LIST_THE_REGIONS =
|
|
12
|
+
const LIST_THE_REGIONS = `list the organisation's primary region (${DEFAULT_REGION} while it sets none), its secondary and disaster recovery regions, and us-east-1`;
|
|
13
13
|
/**
|
|
14
14
|
* An empty list makes DenyOutsideAllowedRegions deny every action outside its
|
|
15
15
|
* exemptions in every member account (inferred, not seen live), and an entry
|
|
@@ -22,7 +22,23 @@ function resolveAllowedRegions(scope, allowedRegions) {
|
|
|
22
22
|
if (allowedRegions === undefined) {
|
|
23
23
|
const orgConfig = parseOrgConfig(scope.node.tryGetContext(CDK_CONTEXT_KEYS.ORG_CONFIG));
|
|
24
24
|
if (deriveRegionsFromOrgConfig(orgConfig).length === 0) {
|
|
25
|
-
|
|
25
|
+
// 40.1.0 read a region of only whitespace as set, so for an org config
|
|
26
|
+
// naming only blank regions a 40.x release renders 40.1.0's list.
|
|
27
|
+
const { primaryRegion } = orgConfig;
|
|
28
|
+
const blank = [
|
|
29
|
+
primaryRegion,
|
|
30
|
+
...orgConfig.secondaryRegions,
|
|
31
|
+
orgConfig.disasterRecoveryRegion
|
|
32
|
+
].filter((region) => region !== undefined && region !== "");
|
|
33
|
+
if (blank.length === 0) {
|
|
34
|
+
throw new Error(`ScpPreset has no allowedRegions and the org config names no region, so it cannot tell which regions member accounts may use. Deploy through Fjall with the organisation's regions named in its org config, or ${LIST_THE_REGIONS} in allowedRegions in the organisation's infrastructure.ts.`);
|
|
35
|
+
}
|
|
36
|
+
const deploysAs = primaryRegion === undefined || primaryRegion === ""
|
|
37
|
+
? [cascadePrimaryRegion(orgConfig)]
|
|
38
|
+
: [];
|
|
39
|
+
const allows = [...new Set([...deploysAs, US_EAST_1])].join(" and ");
|
|
40
|
+
Annotations.of(scope).addWarningV2("fjall:scp-preset:blank-org-regions", `ScpPreset has no allowedRegions and the org config names only blank regions, so it renders the list 40.1.0 rendered. A blank region matches no request, so the regions it allows are ${allows}. Name the organisation's regions in its org config and leave the blank ones out, or ${LIST_THE_REGIONS} in allowedRegions in the organisation's infrastructure.ts. 41.0.0 leaves the blank regions out, so it allows ${DEFAULT_REGION} and ${US_EAST_1}.`);
|
|
41
|
+
return [...new Set([...deploysAs, ...blank, US_EAST_1])];
|
|
26
42
|
}
|
|
27
43
|
return [...new Set([...organisationDeployRegions(orgConfig), US_EAST_1])];
|
|
28
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjall/components-infrastructure",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.2.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/fjall-tech/fjall.git",
|
|
@@ -127,8 +127,8 @@
|
|
|
127
127
|
"vitest": "^4.1.12"
|
|
128
128
|
},
|
|
129
129
|
"dependencies": {
|
|
130
|
-
"@fjall/generator": "^40.
|
|
131
|
-
"@fjall/util": "^40.
|
|
130
|
+
"@fjall/generator": "^40.2.0",
|
|
131
|
+
"@fjall/util": "^40.2.0",
|
|
132
132
|
"constructs": "^10.7.2",
|
|
133
133
|
"zod": "^4.4.3"
|
|
134
134
|
},
|