by mellab2 · 7y ago · 0 comments
I switched from Terraform to Pulumi for a personal project recently and haven't looked back (no affiliation). Writing it with Typescript means you get excellent IDE support (using VSCode here) and access to the enormous JS ecosystem. I've also found myself creating a number of useful abstractions - that I would never have bothered to with HCL - like IAM helper functions, eg:
const limitedReadAccessPolicy = createPolicy(
"product-table-read-access",
allow(
["dynamodb:Get*", "dynamodb:Query"],
[table.arn, interpolate`${table.arn}/index/*`]
)
);
vs resource "aws_iam_policy" "product_read_access" {
name = "madu_${var.env_name}_product_read"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"dynamodb:Get*",
"dynamodb:Query"
],
"Effect": "Allow",
"Resource": [
"${aws_dynamodb_table.products.arn}",
"${aws_dynamodb_table.products.arn}/index/*"
]
}
]
}
EOF
}No comments yet.