Skip to main content

alien_core/
sandbox_setup_parity.rs

1//! What a Terraform setup package creates for a sandbox, against what a direct setup creates.
2//!
3//! The Terraform emitters and the direct-setup controllers are two implementations of one
4//! setup. An item only the emitter produces is a hole in direct setup that nothing else would
5//! notice: the install works until the feature that needs the item is used. Each emitter item is
6//! listed here with its status; the emitters' tests fail on an item that is not listed, and on a
7//! listed item the emitter no longer produces, so a new emitter-only piece cannot land unseen.
8//!
9//! `Pending` is a known gap that is being closed. When it lands, change it to `Creates` and add
10//! the controller test that proves the same grant, with the same role, scope and member.
11
12/// How direct setup treats one item the Terraform package creates.
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub enum DirectSetup {
15    /// Direct setup creates it, with the same role, scope and member as the package.
16    Creates,
17    /// Direct setup does not create it yet. The text names the piece of work that will.
18    Pending(&'static str),
19    /// Only the package creates it. The text names the build refusal that covers it.
20    PackageOnly(&'static str),
21}
22
23/// Items the Google Cloud sandbox emitter produces, keyed by what each one is for.
24pub const GCP_SANDBOX_ITEMS: &[(&str, DirectSetup)] = &[
25    ("engine-grant:access", DirectSetup::Creates),
26    ("engine-grant:templates", DirectSetup::Creates),
27    ("engine-grant:preview", DirectSetup::Creates),
28    ("preview-signer-account", DirectSetup::Creates),
29    ("preview-sign-role", DirectSetup::Creates),
30    ("preview-sign-binding", DirectSetup::Creates),
31    ("image-repository", DirectSetup::Creates),
32    ("image-repository-write", DirectSetup::Creates),
33];
34
35/// Items the Azure sandbox emitter produces, keyed by what each one is for.
36pub const AZURE_SANDBOX_ITEMS: &[(&str, DirectSetup)] = &[
37    ("sandbox-group", DirectSetup::Creates),
38    (
39        "vnet-connection",
40        DirectSetup::PackageOnly(
41            "internet egress needs the package's dedicated sandbox subnets; a direct setup run \
42             refuses it and names the package",
43        ),
44    ),
45    ("role-assignment:access", DirectSetup::Creates),
46    ("role-assignment:images", DirectSetup::Creates),
47    ("role-assignment:workload", DirectSetup::Creates),
48];