@sanoma-ai/connector-gcp 0.1.1 → 0.1.2
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 +12 -0
- package/dist/connector.js +19 -2
- package/dist/connector.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -121,12 +121,24 @@ export const key = gcp.cryptoKey(
|
|
|
121
121
|
|
|
122
122
|
Grant runtime encrypt/decrypt access with `keyIamMember` on the specific key. Keep production and preview identities separate. Rotation creates new key versions; it does not by itself re-encrypt stored ciphertext or retire versions needed by backups. This provisioning surface is separate from the credential-storage adapter in [#470](https://github.com/Sanoma-AI/sanoma/issues/470).
|
|
123
123
|
|
|
124
|
+
### IAM member IDs
|
|
125
|
+
|
|
126
|
+
For `keyIamMember` and `serviceAccountIamMember`, the public operation result's `id` is the provider's import identifier:
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
resource_name role member [condition_title]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Pass that returned `id` unchanged to a subsequent read, including when no saved provider state is available. Sanoma derives it from the structured parent resource, role, member and optional condition title. Custom role paths and `principal://` members retain their slashes. The provider's native `state.id` remains unchanged; its slash-delimited representation is not the import identifier. See the pinned provider's [IAM member import implementation](https://github.com/hashicorp/terraform-provider-google/blob/v8.7.0/google/tpgiamresource/resource_iam_member.go).
|
|
133
|
+
|
|
124
134
|
## Testing and current evidence
|
|
125
135
|
|
|
126
136
|
`fakeGcp` is the bridge's in-memory resource fake; it is not Google IAM or a federation server. Authentication tests use synthetic STS/IAM responses and temporary token/config files, including separate account sources, denied impersonation, rejected key/executable configs and sanitized failures. Driver tests use a provider state double to check concurrent session separation, project/account refusals, symmetric-key and retention guards, OIDC condition requirements, sanitized failures and the fake. The recorded schema/pin in `testdata/` establishes the generated provider contract, not a successful cloud deployment.
|
|
127
137
|
|
|
128
138
|
The [isolated live run](https://github.com/Sanoma-AI/sanoma/actions/runs/41164779676) passed on `e43fb77c1e05d51838687d4574b2678218983386` in project `sanoma-513217`: GitHub OIDC → WIF → scoped provisioning account, denied impersonation of another existing account, real Google-provider key create/read/update, rotation-period update and key-deletion refusal. One provider session remained active for 660 seconds and fetched a fresh OIDC subject token after its ten-minute impersonated token expired. Trust was restricted to numeric repository/owner IDs, branch, workflow and the exact reviewed commit. This proves that provisioning path; it does not establish live CRUD for all seven resource types or a company runtime's identity.
|
|
129
139
|
|
|
140
|
+
A later published-package workflow under [#532](https://github.com/Sanoma-AI/sanoma/issues/532) created a key ring, service account, crypto key and both IAM member types, then exposed a failure when reading an IAM member by its returned ID. The connector now derives importable public IDs while preserving native provider state. Synthetic regression coverage checks custom roles, `principal://` members, optional conditions and reads by returned ID without saved state. A successful live rerun of the full provisioning graph remains pending.
|
|
141
|
+
|
|
130
142
|
The manual `gcp-live.yml` workflow accepts project ID/number, provisioner and denied-account emails, disposable key-ring name and WIF audience as inputs. Administrators must enable billing/APIs, establish narrowly scoped federation and ring permissions, and restrict trust to the intended repository, workflow, ref and reviewed commit before running it. The denied account must exist without an impersonation grant to that federation. No service-account private key is needed. Ordinary CI skips `test/live.test.ts`; only the dedicated workflow enables it. The test creates a synthetic key, so retire all its versions after verification; KMS key/ring metadata remains. Never use a production ring. Provisioning and renewable runtime identity remain separate.
|
|
131
143
|
|
|
132
144
|
Run `pnpm vitest run connectors/gcp` and the repository's type/lint/build checks. Regenerate types with `pnpm --filter @sanoma-ai/connector-gcp generate`; update the recorded schema/pins deliberately, and never edit `resources.gen.ts` by hand. Test-map details are in [test/AGENTS.md](test/AGENTS.md).
|
package/dist/connector.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { tfConnector } from "@sanoma-ai/bridge/connector";
|
|
2
2
|
import { vendorInfo } from "@sanoma-ai/workflows";
|
|
3
3
|
import { provider, google_kms_key_ring, google_kms_crypto_key, google_kms_crypto_key_iam_member, google_service_account, google_service_account_iam_member, google_iam_workload_identity_pool, google_iam_workload_identity_pool_provider, } from "./resources.gen.js";
|
|
4
|
+
// Google's IAM state IDs contain slash-separated role/member/condition fields, but
|
|
5
|
+
// its importer takes space-separated fields. Derive a round-trippable binding ID
|
|
6
|
+
// from structured state rather than parsing slashes inside custom roles/principals.
|
|
7
|
+
const iamBindingId = (parent) => (state) => {
|
|
8
|
+
const condition = state.condition;
|
|
9
|
+
return [state[parent], state.role, state.member, ...(condition?.title ? [condition.title] : [])].join(" ");
|
|
10
|
+
};
|
|
4
11
|
export const gcpTf = tfConnector({
|
|
5
12
|
vendor: "gcp",
|
|
6
13
|
provider,
|
|
@@ -8,9 +15,19 @@ export const gcpTf = tfConnector({
|
|
|
8
15
|
types: {
|
|
9
16
|
keyRing: { tf: google_kms_key_ring, title: "KMS key ring", writable: true },
|
|
10
17
|
cryptoKey: { tf: google_kms_crypto_key, title: "KMS key", writable: true },
|
|
11
|
-
keyIamMember: {
|
|
18
|
+
keyIamMember: {
|
|
19
|
+
tf: google_kms_crypto_key_iam_member,
|
|
20
|
+
title: "KMS key access",
|
|
21
|
+
writable: true,
|
|
22
|
+
bindingId: iamBindingId("crypto_key_id"),
|
|
23
|
+
},
|
|
12
24
|
serviceAccount: { tf: google_service_account, title: "Service account", writable: true },
|
|
13
|
-
serviceAccountIamMember: {
|
|
25
|
+
serviceAccountIamMember: {
|
|
26
|
+
tf: google_service_account_iam_member,
|
|
27
|
+
title: "Service account access",
|
|
28
|
+
writable: true,
|
|
29
|
+
bindingId: iamBindingId("service_account_id"),
|
|
30
|
+
},
|
|
14
31
|
workloadIdentityPool: { tf: google_iam_workload_identity_pool, title: "Workload identity pool", writable: true },
|
|
15
32
|
workloadIdentityProvider: { tf: google_iam_workload_identity_pool_provider, title: "OIDC trust", writable: true },
|
|
16
33
|
},
|
package/dist/connector.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.js","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6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Aa,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE;QAC1D,uBAAuB,EAAE,EAAE,kBAAkB,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE;KAChF;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanoma-ai/connector-gcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Google Cloud KMS and IAM provisioning through isolated OpenTofu provider sessions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"connector",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@sanoma-ai/bridge": "0.5.1",
|
|
58
|
-
"@sanoma-ai/workflows": "0.10.
|
|
58
|
+
"@sanoma-ai/workflows": "0.10.11",
|
|
59
59
|
"msw": "^3.0.3",
|
|
60
60
|
"zod": "^4.6.5"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@sanoma-ai/bridge": "^0.5.1",
|
|
64
|
-
"@sanoma-ai/workflows": "^0.10.
|
|
64
|
+
"@sanoma-ai/workflows": "^0.10.11",
|
|
65
65
|
"zod": "^4"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|