Skip to content

feat(object): add object sse_customer_key_wo#3619

Closed
estellesoulard wants to merge 4 commits intomainfrom
feat/add-object-sse-key-wo
Closed

feat(object): add object sse_customer_key_wo#3619
estellesoulard wants to merge 4 commits intomainfrom
feat/add-object-sse-key-wo

Conversation

@estellesoulard
Copy link
Copy Markdown
Contributor

@estellesoulard estellesoulard commented Jan 22, 2026

Leaving this PR as draft as the inherent limitations of having a Write Only encryption key have a big impact on the functionality. S3 object HEAD calls require the key, but the key being WriteOnly means it won't be available. This causes the following limitations :

  • not being able to query the datasource specifically for sse_customer_key_wo encrypted objects
  • having a partial state return specifically for sse_customer_key_wo encrypted objects create/update

@github-actions github-actions bot added the object Object storage issues, bugs and feature requests label Jan 22, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 0% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 2.32%. Comparing base (98d5689) to head (60b2465).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
internal/services/object/object.go 0.00% 55 Missing ⚠️
internal/services/object/data_source_object.go 0.00% 11 Missing ⚠️
internal/services/object/testfuncs/checks.go 0.00% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #3619      +/-   ##
=========================================
- Coverage    2.32%   2.32%   -0.01%     
=========================================
  Files         450     450              
  Lines       49153   49200      +47     
=========================================
- Hits         1144    1142       -2     
- Misses      47919   47967      +48     
- Partials       90      91       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@estellesoulard estellesoulard force-pushed the feat/add-object-sse-key-wo branch from b1d8448 to d40c260 Compare January 22, 2026 11:12
Comment thread examples/resources/scaleway_object/resource-basic.tf Outdated
Comment thread examples/resources/scaleway_object/resource-encryption-wo.tf Outdated
datasource.FixDatasourceSchemaFlags(dsSchema, true, "bucket", "key")

datasource.AddOptionalFieldsToSchema(dsSchema, "region", "project_id")
datasource.AddOptionalFieldsToSchema(dsSchema, "region", "project_id", "sse_customer_key")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Currently we could not get an sse_customer_key encrypted datasource (the key is required to build the proper s3 HeadObject call headers)

Comment on lines +59 to +64
// Add encryption headers if present (similar to resourceObjectRead)
// Only the regular (non Write Only) sse_customer_key can be set.
// Data sources cannot read objects encrypted with write-only keys
// since the actual key is not available in the data source configuration.
// Data sources cannot have WriteOnly attributes. Making it available would
// set the key in the state.
Copy link
Copy Markdown
Contributor Author

@estellesoulard estellesoulard Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This limitation is why I am considering not merging this PR at all. Is this restriction (not being able to query the datasource specifically for sse_customer_key_wo encrypted objects) something we are OK with ? We might as well have a dedicated Ephemeral Resource at that point.

Comment on lines +182 to +185
// The only way to get an encrypted object is to provide the sse_customer_key. For a sse_customer_key_wo,
// datasources cannot have Write Only attributes, so we have to pass it as a regular sse_customer_key.
// This is not ideal, as the key is then set in the state, making the Write Only useless...
// Querying objects encrypted with a sse_customer_key_wo is discouraged.
Copy link
Copy Markdown
Contributor Author

@estellesoulard estellesoulard Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This limitation is why I am considering not merging this PR at all. Is this restriction (not being able to query the datasource specifically for sse_customer_key_wo encrypted objects) something we are OK with ? We might as well have a dedicated Ephemeral Resource at that point.

Comment thread internal/services/object/object.go Outdated
Comment thread internal/services/object/object.go Outdated
Comment on lines +440 to +442
// Object was encrypted with write-only key, but we can't read it back
// since the actual key is not stored in state. This is expected behavior.
// Skip the HeadObject call and return partial state
Copy link
Copy Markdown
Contributor Author

@estellesoulard estellesoulard Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This limitation is why I am considering not merging this PR at all. Is this restriction (having a partial state return specifically for sse_customer_key_wo encrypted objects create/update) something we are OK with ? We might as well have a dedicated Ephemeral Resource at that point.

Comment thread templates/resources/object.md.tmpl Outdated
@remyleone remyleone deleted the branch main February 27, 2026 10:20
@remyleone remyleone closed this Feb 27, 2026
@estellesoulard estellesoulard changed the base branch from master to main February 27, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

object Object storage issues, bugs and feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants