unoverse 0.1.102 → 0.1.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/operator/infra/aws/main.tf +15 -0
- package/operator/lib/deploy.sh +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,9 @@ terraform {
|
|
|
11
11
|
aws = { source = "hashicorp/aws", version = ">= 5.83, < 6.0" }
|
|
12
12
|
random = { source = "hashicorp/random", version = "~> 3.6" }
|
|
13
13
|
archive = { source = "hashicorp/archive", version = "~> 2.4" }
|
|
14
|
+
# For the IAM propagation wait below. IAM is eventually consistent and Lambda is the
|
|
15
|
+
# one resource here that reliably outruns it.
|
|
16
|
+
time = { source = "hashicorp/time", version = "~> 0.11" }
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
19
|
|
|
@@ -369,7 +372,19 @@ resource "aws_iam_role_policy_attachment" "pretoken_logs" {
|
|
|
369
372
|
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
|
|
370
373
|
}
|
|
371
374
|
|
|
375
|
+
# IAM IS EVENTUALLY CONSISTENT, AND LAMBDA OUTRUNS IT. The role is created, Lambda is
|
|
376
|
+
# created two seconds later, and AWS answers "The role defined for the function cannot be
|
|
377
|
+
# assumed by Lambda" — the role is correct and simply not visible yet. Terraform's
|
|
378
|
+
# dependency graph is satisfied because the role exists; AWS's own propagation is not.
|
|
379
|
+
#
|
|
380
|
+
# Ten seconds is the usual advice and it costs ten seconds on a first apply only.
|
|
381
|
+
resource "time_sleep" "iam_propagation" {
|
|
382
|
+
depends_on = [aws_iam_role.pretoken, aws_iam_role_policy_attachment.pretoken_logs]
|
|
383
|
+
create_duration = "10s"
|
|
384
|
+
}
|
|
385
|
+
|
|
372
386
|
resource "aws_lambda_function" "pretoken" {
|
|
387
|
+
depends_on = [time_sleep.iam_propagation]
|
|
373
388
|
function_name = "${var.name}-pretoken"
|
|
374
389
|
role = aws_iam_role.pretoken.arn
|
|
375
390
|
runtime = "nodejs20.x"
|
package/operator/lib/deploy.sh
CHANGED
|
@@ -563,7 +563,7 @@ _ground_apply() {
|
|
|
563
563
|
echo ""
|
|
564
564
|
info "Building. Managed databases take a few minutes on the provider's side"
|
|
565
565
|
echo ""
|
|
566
|
-
terraform -chdir="$dir" apply -input=false "$planfile" || { fail "The build did not finish.
|
|
566
|
+
terraform -chdir="$dir" apply -input=false "$planfile" || { fail "The build did not finish. Nothing already built is lost — re-run: unoverse deploy $cloud"; rm -rf "$tmp"; return 1; }
|
|
567
567
|
rm -rf "$tmp"
|
|
568
568
|
return 0
|
|
569
569
|
}
|
package/package.json
CHANGED