Skip to content

Instantly share code, notes, and snippets.

@danopia
Created January 2, 2022 12:54
Show Gist options
  • Save danopia/60b265e21af3917db70376c11417d0eb to your computer and use it in GitHub Desktop.
Save danopia/60b265e21af3917db70376c11417d0eb to your computer and use it in GitHub Desktop.
terraform json typescript
interface ChangedResource {
address: string;
module_address: string;
mode: "data" | "managed";
type: string;
name: string;
index?: number | string;
provider_name: string;
change: {
actions: Actions;
before: null | Record<string, unknown>;
after: null | Record<string, unknown>;
after_unknown: null | Record<string, unknown>;
before_sensitive: null | Record<string, unknown> | true;
after_sensitive: null | Record<string, unknown>;
};
}
type Actions =
| ["no-op"]
| ["create"]
| ["read"]
| ["update"]
| ["delete", "create"]
| ["create", "delete"]
| ["delete"]
interface Configuration {
provider_config: Record<string, ProviderConfig>;
root_module: ModuleConfig;
}
interface ProviderConfig {
name: string;
version_constraint?: string;
expressions?: Expressions;
module_address?: string;
alias?: string;
}
type Expressions = Record<string, unknown>;
type Expression = {
constant_value: unknown;
} | {
references: string[];
}
interface ModuleConfig {
resources: ResourceConfig[];
module_calls?: Record<string, ModuleCall>;
outputs?: Record<string, unknown>;
variables?: Record<string, unknown>;
}
interface ModuleCall {
source: string;
expressions: Expressions;
module: ModuleConfig;
for_each_expression?: Expression;
version_constraint?: string;
}
interface ResourceConfig {
address: string;
mode: "data" | "managed";
type: string;
name: string;
provider_config_key: string;
expressions?: Expressions;
schema_version: number;
depends_on?: string[];
count_expression?: Expression;
for_each_expression?: Expression;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment