Skip to content

Commit 4414b69

Browse files
committed
feat(s3): model BlockedEncryptionTypes on bucket default encryption
ServerSideEncryptionRule now exposes BlockedEncryptionTypes (an EncryptionType listing of NONE/SSE-C), matching the property the Cloud Control runtime already reads. Without it, a bucket that blocks SSE-C could not be declared: extract omitted the field and reconcile planned to strip it, so bring-under-management was not side-effect free. Adds a dedicated conformance fixture (and update variant flipping SSE-C to NONE) exercising the round-trip.
1 parent 7449a5f commit 4414b69

4 files changed

Lines changed: 120 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
Install with `sudo formae plugin install aws` on the host that runs the
99
formae agent.
1010

11+
## [Unreleased]
12+
13+
### Added
14+
15+
- S3 `BucketEncryption`: `ServerSideEncryptionRule` now models
16+
`BlockedEncryptionTypes` (an `EncryptionType` listing of `NONE`/`SSE-C`), so
17+
buckets that block SSE-C round-trip through extract and reconcile instead of
18+
having the setting stripped on bring-under-management.
19+
1120
## [0.1.16]
1221

1322
### Changed

schema/pkl/s3/bucket.pkl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ open class AnalyticsConfiguration extends formae.SubResource {
4242
tagFilters: Listing<aws.Tag>?
4343
}
4444

45+
typealias EncryptionType = "NONE"|"SSE-C"
46+
47+
@aws.SubResourceHint
48+
open class BlockedEncryptionTypes extends formae.SubResource {
49+
encryptionType: Listing<EncryptionType>?
50+
}
51+
4552
@aws.SubResourceHint
4653
open class BucketEncryption extends formae.SubResource {
4754
serverSideEncryptionConfiguration: Listing<ServerSideEncryptionRule>
@@ -477,6 +484,8 @@ open class ServerSideEncryptionByDefault extends formae.SubResource {
477484

478485
@aws.SubResourceHint
479486
open class ServerSideEncryptionRule extends formae.SubResource {
487+
blockedEncryptionTypes: BlockedEncryptionTypes?
488+
480489
bucketKeyEnabled: Boolean?
481490

482491
serverSideEncryptionByDefault: ServerSideEncryptionByDefault?
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* © 2025 Platform Engineering Labs Inc.
3+
*
4+
* SPDX-License-Identifier: FSL-1.1-ALv2
5+
*/
6+
7+
amends "@formae/forma.pkl"
8+
import "@formae/formae.pkl"
9+
10+
import "@aws/aws.pkl"
11+
12+
import "@aws/s3/bucket.pkl"
13+
14+
// Read the test run ID from environment variable set by the test harness
15+
// This ensures consistent naming within a test run but unique names between runs
16+
local testRunID = read("env:FORMAE_TEST_RUN_ID")
17+
local stackName = "plugin-sdk-test-s3-bucket-encryption-\(testRunID)"
18+
19+
forma {
20+
new formae.Stack {
21+
label = stackName
22+
description = "Plugin SDK test for S3 Bucket default encryption with BlockedEncryptionTypes"
23+
}
24+
25+
new formae.Target {
26+
label = "aws-target"
27+
config = new aws.Config {
28+
region = "us-east-1"
29+
}
30+
}
31+
32+
new bucket.Bucket {
33+
label = "plugin-sdk-test-bucket-encryption"
34+
bucketName = "formae-plugin-sdk-test-encryption-\(testRunID)"
35+
bucketEncryption = new bucket.BucketEncryption {
36+
serverSideEncryptionConfiguration {
37+
new bucket.ServerSideEncryptionRule {
38+
bucketKeyEnabled = true
39+
serverSideEncryptionByDefault = new bucket.ServerSideEncryptionByDefault {
40+
sseAlgorithm = "AES256"
41+
}
42+
blockedEncryptionTypes = new bucket.BlockedEncryptionTypes {
43+
encryptionType {
44+
"NONE"
45+
}
46+
}
47+
}
48+
}
49+
}
50+
}
51+
}

testdata/s3-bucket-encryption.pkl

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* © 2025 Platform Engineering Labs Inc.
3+
*
4+
* SPDX-License-Identifier: FSL-1.1-ALv2
5+
*/
6+
7+
amends "@formae/forma.pkl"
8+
import "@formae/formae.pkl"
9+
10+
import "@aws/aws.pkl"
11+
12+
import "@aws/s3/bucket.pkl"
13+
14+
// Read the test run ID from environment variable set by the test harness
15+
// This ensures consistent naming within a test run but unique names between runs
16+
local testRunID = read("env:FORMAE_TEST_RUN_ID")
17+
local stackName = "plugin-sdk-test-s3-bucket-encryption-\(testRunID)"
18+
19+
forma {
20+
new formae.Stack {
21+
label = stackName
22+
description = "Plugin SDK test for S3 Bucket default encryption with BlockedEncryptionTypes"
23+
}
24+
25+
new formae.Target {
26+
label = "aws-target"
27+
config = new aws.Config {
28+
region = "us-east-1"
29+
}
30+
}
31+
32+
new bucket.Bucket {
33+
label = "plugin-sdk-test-bucket-encryption"
34+
bucketName = "formae-plugin-sdk-test-encryption-\(testRunID)"
35+
bucketEncryption = new bucket.BucketEncryption {
36+
serverSideEncryptionConfiguration {
37+
new bucket.ServerSideEncryptionRule {
38+
bucketKeyEnabled = true
39+
serverSideEncryptionByDefault = new bucket.ServerSideEncryptionByDefault {
40+
sseAlgorithm = "AES256"
41+
}
42+
blockedEncryptionTypes = new bucket.BlockedEncryptionTypes {
43+
encryptionType {
44+
"SSE-C"
45+
}
46+
}
47+
}
48+
}
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)