terradart_aws 0.29.0
terradart_aws: ^0.29.0 copied to clipboard
Curated factory wrappers for AWS resources (hashicorp/aws Terraform provider) for Dart-first Terraform stacks.
terradart_aws #
Curated factory wrappers for AWS resources (the hashicorp/aws Terraform provider) for Dart-first Terraform stacks.
The catalog is the full hashicorp/aws 6.66.0 provider: 1725 resource factories and 683 data sources. Start from a Dart backend on AWS Lambda: an execution role, a managed-policy attachment, the function, a function URL, and a log group, plus the aws_iam_policy_document and aws_caller_identity data sources.
Security & Credentials #
Credentials never appear in synth output by design. The AWS provider schema does not mark its credential arguments sensitive, so AwsProvider leaves them out by name: there is no access_key, secret_key, token, or assume_role_with_web_identity parameter. Authenticate at apply time through the AWS SDK credential chain: AWS_PROFILE with your shared config, AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_SESSION_TOKEN, or an instance or task role. assumeRole, defaultTags, ignoreTags and endpoints are typed settings on AwsProvider.
Installation #
dependencies:
terradart_core: ^0.29.x
terradart_aws: ^0.29.x
Usage example #
import 'package:terradart_aws/data.dart';
import 'package:terradart_aws/iam.dart';
import 'package:terradart_aws/lambda.dart';
import 'package:terradart_aws/provider.dart';
import 'package:terradart_core/terradart_core.dart';
final class HelloStack extends Stack {
HelloStack()
: super(providers: [
const AwsProvider(
region: 'us-east-1',
defaultTags: {'app': 'hello-dart'},
),
]) {
final trust = DataAwsIamPolicyDocument(
localName: 'lambda_trust',
statement: [
DataIamPolicyDocumentStatement(
actions: TfArg.literal(['sts:AssumeRole']),
principals: [
DataIamPolicyDocumentStatementPrincipals(
type: TfArg.literal('Service'),
identifiers: TfArg.literal(['lambda.amazonaws.com']),
),
],
),
],
);
addData(trust);
final role = AwsIamRole(
localName: 'hello',
assumeRolePolicy: TfArg.ref(trust.json),
);
add(role);
add(AwsLambdaFunction(
localName: 'hello',
functionName: TfArg.literal('hello-dart'),
role: TfArg.ref(role.arn),
runtime: TfArg.literal('provided.al2023'),
handler: TfArg.literal('bootstrap'),
filename: TfArg.literal('build/bootstrap.zip'),
));
}
}
dart pub get
dart run bin/infra.dart
cd tf-out && terraform init && AWS_PROFILE=... terraform apply
Curated surface #
1725 resource factories + 683 data sources (2408 catalog entries) across per-service barrels (ec2, iam, lambda, s3, rds, …) plus data. Provider pinned exactly at 6.66.0. Start with examples/aws_lambda_quickstart, which builds the bootstrap zip from a Dart handler. examples/aws_static_site_quickstart hosts a Flutter Web build on S3 + CloudFront with a custom domain, and examples/aws_ecs_express_quickstart runs a Dart server on ECS Express Mode; both need real AWS setup to apply (their READMEs' "Before you apply"). The rest of the catalog is exercised by examples/aws_leftover_quickstart (synth + terraform validate only).
The six most deeply nested resources (AwsWafv2WebAcl, AwsWafv2WebAclRule, AwsWafv2RuleGroup, AwsQuicksightAnalysis, AwsQuicksightDashboard, AwsQuicksightTemplate) take typed nested helpers, but a block shape that repeats inside one resource gets one helper, named after its shallowest occurrence. AwsWafv2WebAclRule(challengeConfig: ...) therefore takes Wafv2WebAclRuleCaptchaConfig, and an asnMatchStatement nested inside andStatement levels takes the same Wafv2WebAclRuleStatementAsnMatchStatement as a top-level one. The inline rule blocks on AwsWafv2WebAcl stay a TfArg<Map<String, dynamic>> map; manage rules through AwsWafv2WebAclRule for the typed form.
Generated by the maintainer pipeline (terradart wrap against the pin fixture); do not hand-edit files under lib/src/.