Ignore changes to DDE blueprints list to mitigate noise#1028
Conversation
Operating assumptions is the list of blueprints won't change frequently after initially setting things up. So default to ignoring changes there to workaround (likely) provider issues which would break useful functionality like the `check-infra-deploy-status.yml` workflow.
071590d to
e0d4d91
Compare
sean-navapbc
left a comment
There was a problem hiding this comment.
- Verify what happens when you DO want to change blueprints (follow the documented process)
- Confirm other attributes of the resource still show diffs correctly
- Test that the check-infra-deploy-status.yml workflow now passes
This comment was marked as low quality.
This comment was marked as low quality.
@sean-navapbc Added please take a look. |
Pragmatic Workaround ReviewThis PR implements a reasonable workaround for the awscc provider list ordering bug (hashicorp/terraform-provider-awscc#3058). The approach is sound and well-documented, but the manual update process has some operational risks. ✅ What This PR Does Well
|
Additional Enhancement Suggestions1. Add Example Blueprint FileConsider adding an example custom blueprint JSON file to help users understand the structure: Create: {
"name": "invoice-extraction",
"description": "Extract structured data from invoices",
"schema": {
"type": "object",
"properties": {
"invoice_number": {
"type": "string",
"description": "Invoice identifier"
},
"date": {
"type": "string",
"format": "date",
"description": "Invoice date"
},
"total_amount": {
"type": "number",
"description": "Total invoice amount"
}
},
"required": ["invoice_number", "date", "total_amount"]
}
}Then reference this in the documentation under the "Custom blueprints" section. 2. Optional: Create Verification Helper ScriptFor teams that frequently need to verify blueprint state, consider adding a script: Create: #!/bin/bash
# Verify deployed DDE blueprints match Terraform configuration
set -euo pipefail
APP_NAME=${1:-}
ENVIRONMENT=${2:-}
if [[ -z "$APP_NAME" || -z "$ENVIRONMENT" ]]; then
echo "Usage: $0 <app_name> <environment>"
exit 1
fi
PROJECT_NAME="${APP_NAME}-${ENVIRONMENT}-project"
echo "Fetching deployed blueprints for $PROJECT_NAME..."
DEPLOYED_BLUEPRINTS=$(aws bedrock-data-automation describe-project \
--project-name "$PROJECT_NAME" \
--query 'customOutputConfiguration.blueprints[*].blueprintArn' \
--output json | jq -r '.[] | select(. != null)' | sort)
echo ""
echo "Deployed Blueprints:"
echo "$DEPLOYED_BLUEPRINTS"
echo ""
echo "Compare with configured blueprints in:"
echo " infra/$APP_NAME/app-config/env-config/document_data_extraction.tf"
echo ""
echo "⚠️ Note: Differences may exist due to ignore_changes in Terraform"Make it executable: This gives operators a quick way to check for drift without relying on Terraform. |
Testing RecommendationBefore merging, please test the blueprint removal scenario to verify Test Case: Blueprint Removal
Why This MattersIf
If the test reveals issues with removals, consider documenting this specific limitation in the "Updating blueprints" section. Related question: Does the |
Review Summary✅ Review Complete - Posted 2 inline suggestions + 2 enhancement comments Inline Suggestions (can be applied with one click):
Additional Recommendations (in comments):
What I Like About This PR:
View the full review: #1028 |
sean-navapbc
left a comment
There was a problem hiding this comment.
I'm approving as is with recommendations below
This already exists in the location mentioned in the existing docs: https://github.com/navapbc/template-infra/blob/main/infra/%7B%7Bapp_name%7D%7D/service/document-data-extraction-blueprints/template_blueprint.json
Possibly as further mitigation in #1027 as a part of some automated detection and targeted state change if upstream doesn't fix the underlying issue soon.
It does not, but has some interactions with the BDA project that have been called out. |
Ticket
Related to #1027
Changes
Due to (presumed) underlying provider limitations, when specifying blueprints to use, the BDA project resource will always show a diff between the IaC and current state.
Operating assumption is the list of blueprints won't change frequently after initially setting things up. So default to ignoring changes there to workaround (likely) provider issues which would break useful functionality like the
check-infra-deploy-status.ymlworkflow.Added docs for the manual steps involved why you do want to update blueprints and since no docs existed for the feature in general, added some basics there too.
In addition, the blueprint resources should have
create_before_destroy=trueTerraform lifecycle setting so the BDA project is updated to drop the blueprint before the blueprint itself is destroyed, which would cause errors otherwise.Testing
As a part of navapbc/platform-test#278, making no config (or any other) changes and just running
make infra-update-app-service APP_NAME=app-documentai ENVIRONMENT=devBefore (no
ignore_changes):After (with
ignore_changes):Other attributes that change still show up
Adding/removing blueprints process
When adding a new custom template (
tester.jsonhere), the template resource itself is created:But that's it, the project config is not updated:
Unless you follow the instructions, commenting out the ignore_changes line:
The diff is confusing due to the ordering bug, but the new templates does show up in the project:
The same applies when adding an existing ARN and adding/removing blueprints (evidence left out here for brevity).
Checking infra state
All the
check-infra-deploy-status.ymlworkdlow does is runterraform plan -detailed-exitcodeagainst the root modules, which just exits non-zero if there are state changes. Existing evidence shows there are state changes in a service's root module without this fix, and no state changes with it. ButRelevant section from

./bin/infra-deploy-status-check-configs:Then run:
terraform -chdir="infra/app-documentai/service" plan -input=false -detailed-exitcode -var="environment_name=dev"simulating the CI check.With

ignore_changes:Without

ignore_changes: