@sanoma-ai/connector-gcp 0.1.2 → 0.1.3

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 CHANGED
@@ -131,6 +131,8 @@ resource_name role member [condition_title]
131
131
 
132
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
133
 
134
+ Google 8.7.0 reports an absent IAM member as an import error after reading its parent's policy. For these two IAM types, Sanoma recognizes only that specific missing-binding diagnostic as absence: reads return `gone: true`, provisioning can read before creating a grant, and deleting an already absent grant is idempotent. Permission failures, ambiguous conditions and other diagnostics remain sanitized errors.
135
+
134
136
  ## Testing and current evidence
135
137
 
136
138
  `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.
@@ -139,6 +141,8 @@ The [isolated live run](https://github.com/Sanoma-AI/sanoma/actions/runs/4116477
139
141
 
140
142
  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
143
 
144
+ The next published run passed those ID reads, then stopped while importing a grant that did not exist. A separate live read reproduced the provider's missing-binding diagnostic. The corrected unpublished driver then passed live absent-member reads and idempotent deletion for both IAM types against the existing disposable resources. A published rerun of the full provisioning graph remains pending.
145
+
142
146
  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.
143
147
 
144
148
  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/driver.js CHANGED
@@ -34,7 +34,7 @@ export function gcpDriver(identities, bridge = defaultBridge()) {
34
34
  throw new AuthenticationError("wrong_account");
35
35
  }
36
36
  const credentials = await federationCredentials(identity);
37
- const driver = gcpTf.driver(retainKeys(bridge), () => ({ credentials: JSON.stringify(credentials), project: identity.project }), undefined, undefined, { authentication: ["workloadIdentity"] });
37
+ const driver = gcpTf.driver(retainKeys(iamImports(bridge)), () => ({ credentials: JSON.stringify(credentials), project: identity.project }), undefined, undefined, { authentication: ["workloadIdentity"] });
38
38
  try {
39
39
  return await driver.ops[operation]({ ...input, ...checked }, call);
40
40
  }
@@ -49,4 +49,30 @@ export function gcpDriver(identities, bridge = defaultBridge()) {
49
49
  ])),
50
50
  };
51
51
  }
52
+ /** Google 8.7.0 imports read the policy but report an absent member as an error. */
53
+ function iamImports(bridge) {
54
+ return {
55
+ ...bridge,
56
+ import: async (...args) => {
57
+ try {
58
+ return await bridge.import(...args);
59
+ }
60
+ catch (error) {
61
+ const failure = error;
62
+ if (["google_kms_crypto_key_iam_member", "google_service_account_iam_member"].includes(args[1]) &&
63
+ failure?.code === "failed_precondition" &&
64
+ Array.isArray(failure.diagnostics) &&
65
+ failure.diagnostics.length === 1) {
66
+ const diagnostic = failure.diagnostics[0];
67
+ if (diagnostic?.severity === "error" &&
68
+ diagnostic.detail === "" &&
69
+ diagnostic.attributePath === "" &&
70
+ /^Cannot find binding for "(?:[^"\\]|\\.)*" with role "(?:[^"\\]|\\.)*", member "(?:[^"\\]|\\.)*", and condition title "(?:[^"\\]|\\.)*"$/.test(diagnostic.summary))
71
+ return { resources: [], warnings: [] };
72
+ }
73
+ throw error;
74
+ }
75
+ },
76
+ };
77
+ }
52
78
  //# sourceMappingURL=driver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"driver.js","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuB,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAiC,MAAM,sBAAsB,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAsB,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,UAAU,SAAS,CAAC,UAAyB,EAAE,MAAM,GAAmB,aAAa,EAAE;IAC3F,OAAO;QACL,MAAM,EAAE,KAAK;QACb,cAAc,EAAE,CAAC,kBAAkB,CAAC;QACpC,GAAG,EAAE,MAAM,CAAC,WAAW,CACrB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC;YACnE,SAAS;YACT,KAAK,EACH,KAA0F,EAC1F,IAAiB,EACjB,EAAE;gBACF,IAAI,IAAI,CAAC,cAAc,EAAE,MAAM,KAAK,kBAAkB,IA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E,CAAC;gBAC3C,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanoma-ai/connector-gcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Google Cloud KMS and IAM provisioning through isolated OpenTofu provider sessions",
5
5
  "keywords": [
6
6
  "connector",
@@ -54,14 +54,14 @@
54
54
  "google-auth-library": "^10.5.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@sanoma-ai/bridge": "0.5.1",
58
- "@sanoma-ai/workflows": "0.10.11",
57
+ "@sanoma-ai/bridge": "0.5.2",
58
+ "@sanoma-ai/workflows": "0.11.0",
59
59
  "msw": "^3.0.3",
60
60
  "zod": "^4.6.5"
61
61
  },
62
62
  "peerDependencies": {
63
- "@sanoma-ai/bridge": "^0.5.1",
64
- "@sanoma-ai/workflows": "^0.10.11",
63
+ "@sanoma-ai/bridge": "^0.5.2",
64
+ "@sanoma-ai/workflows": "^0.11.0",
65
65
  "zod": "^4"
66
66
  },
67
67
  "engines": {