Skip to main content

CloudServices

Struct CloudServices 

Source
pub struct CloudServices {
    pub provider: CloudProvider,
    pub terraform: String,
    pub vars: IndexMap<String, Value>,
    pub outputs: IndexMap<String, String>,
    pub hourly_usd: Option<f64>,
    pub before: Vec<String>,
    pub env: IndexMap<String, String>,
    pub apply_retries: u8,
    pub requires: Vec<String>,
}
Expand description

An environment of cloud services: a Terraform module applied into the user’s account.

Fields§

§provider: CloudProvider

The cloud the module deploys into (its credentials come from the environment, as Terraform expects).

§terraform: String

A Terraform root module in the project (a folder holding .tf files), used as is.

§vars: IndexMap<String, Value>

The module’s variables: any value (a string, number, boolean, list or map). A string holding {{ inputs.NAME }}, at any depth (["{{ inputs.PLAYER_IP }}/32"]), takes the launch-time input NAME (declared in inputs), e.g. the user’s IP for an allow-list: required at isothrum up, kept for isothrum down.

§outputs: IndexMap<String, String>

What the environment exposes, by name: a module output each. Checks and the message use them as {{ cloud.outputs.<name> }}.

§hourly_usd: Option<f64>

About what the environment costs per hour while it exists, in US dollars: the author’s estimate, for whoever runs it. isothrum up says it before applying, and the resolved snapshot carries it (cloud.hourly_usd) for anything that shows costs or keeps to a budget. Isoloom doesn’t bill or stop anything by it.

§before: Vec<String>

Steps run on this machine before Terraform applies the module (a key pair the module reads, a build): scripts in the project, run in order from the module’s copy, with the spec’s inputs and env in their environment. They run at every isothrum up: make them idempotent.

§env: IndexMap<String, String>

Environment variables for Terraform and the before steps (AWS_REGION: us-east-1). Not for credentials: those come from the user’s own environment.

§apply_retries: u8

How many times to apply again when an apply fails (a module that only converges on a second apply), 0 to 5. 0 by default.

§requires: Vec<String>

What the module needs on this machine besides Terraform: a command name (jq, gsed) that must be on the PATH, or a shell command that must succeed (python3 -c 'import boto3'). isothrum up checks them before applying.

Implementations§

Source§

impl CloudServices

Source

pub fn input_of(value: &Value) -> Option<&str>

The launch-time input a variable takes, when its value is exactly {{ inputs.NAME }}. A value can also hold inputs inside its strings, at any depth: see inputs_in.

Source

pub fn inputs_in(value: &Value) -> Vec<String>

The launch-time inputs a variable’s value takes: every {{ inputs.NAME }} in its strings, at any depth, in order (repeats kept).

Source

pub fn fill_inputs( value: &Value, input: &mut dyn FnMut(&str) -> Option<String>, ) -> Value

The value with each {{ inputs.NAME }} in its strings, at any depth, replaced by input(NAME) (left as written when it gives nothing).

Trait Implementations§

Source§

impl Clone for CloudServices

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CloudServices

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CloudServices

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for CloudServices

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for CloudServices

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for CloudServices

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CloudServices

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.