terradart_google 0.36.0
terradart_google: ^0.36.0 copied to clipboard
Curated factory wrappers for Google Cloud resources (Compute, BigQuery, Cloud Run, Cloud SQL, Pub/Sub, Monitoring, ...) for Dart-first Terraform stacks.
terradart_google #
Curated factory wrappers for Google Cloud resources (the official hashicorp/google Terraform provider) for Dart-first Terraform stacks.
Ships 1380 curated resource factories + 472 data sources (1852 catalog entries) across per-service barrels (compute, pubsub, cloud_run, bigquery, …). The GA hashicorp/google catalog is filled.
Beta-only types live in terradart_google_beta (112 resource factories). The full factory table with example pointers is on Coverage. Discover factories programmatically via package:terradart_google/catalog.dart (terradartCatalog).
Installation #
dependencies:
terradart_core: ^0.36.0
terradart_google: ^0.36.0
Usage example #
// lib/assets_stack.dart
import 'package:terradart_google/provider.dart';
import 'package:terradart_google/storage.dart';
final class AssetsStack extends Stack {
AssetsStack({required String projectId})
: super(providers: [
GoogleProvider(project: projectId, region: 'asia-northeast1'),
]) {
add(GoogleStorageBucket(
'assets',
name: .literal('my-app-assets-prod'),
location: .literal('ASIA-NORTHEAST1'),
storageClass: .standard,
));
}
}
// bin/infra.dart
import 'package:my_app/assets_stack.dart';
Future<void> main() async {
final stack = AssetsStack(projectId: 'my-project-id');
await stack.writeTo('tf-out');
}
dart pub get
dart pub global activate terradart_cli
terradart apply
Register a second configuration, a GoogleProvider with an alias, through addProvider, and select it on a resource with its provider argument — every factory and data source takes a provider (Terraform's provider meta-argument), a provider instance the Stack registers; a registered GoogleBetaProvider puts a GA type on the beta provider.
final eu = addProvider(GoogleProvider(alias: 'eu', region: 'europe-west1'));
add(GooglePubsubTopic('eu-orders', name: .literal('eu-orders'), provider: eu));
Per-service imports (cloud_run.dart, storage.dart, …) keep IDE completion scoped. See examples/ and the pubsub quickstart for the app boundary (addConstant, addOutput).
How resources are built #
Factory wrappers under lib/src/<service>/ are emitted by terradart-codegen wrap from curated overrides in terradart_codegen. They are committed so consumers depend on terradart_google without running codegen locally.
CI verifies determinism via terradart-codegen wrap --check. Runtime primitives (Stack, TfArg, writeTo) live in terradart_core.