refactor: simplify crud-pricing to pure CRUD layer - remove AWS API clients
All checks were successful
kinec.tech/airun-pathfinder-crud-pricing/pipeline/head This commit looks good

Removed AWS Pricing API and Cost Explorer clients to make crud-pricing
a pure DynamoDB CRUD layer. This fixes layer violation where CRUD was
making external AWS API calls.

Changes:
- Deleted src/aws_pricing.rs (AWS Pricing API client)
- Deleted src/cost_explorer.rs (Cost Explorer client)
- Removed PricingClient and StsClient from main.rs
- Removed QueryAwsApi and QueryCostExplorer operations
- Removed fetch_if_missing behavior (Get operation now only reads from cache)
- Removed aws-sdk-pricing, aws-sdk-costexplorer, aws-sdk-sts dependencies
- Removed pricing_api_access and sts_assume_role IAM policies

Result: Pure CRUD layer with only DynamoDB operations (Get, Put, ListCommon, IncrementAccess)
Reduced from ~1100 lines to ~600 lines

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-27 04:44:44 -05:00
parent e88609d724
commit ea8883d0da
6 changed files with 8 additions and 815 deletions

View File

@@ -23,6 +23,11 @@ provider "aws" {
}
}
# Data source: Get Gateway ID from platform-core
data "aws_ssm_parameter" "gateway_id" {
name = "/airun-pathfinder/${var.environment}/gateway-id"
}
# Get current AWS account ID
data "aws_caller_identity" "current" {}
@@ -124,47 +129,6 @@ resource "aws_iam_role_policy" "dynamodb_access" {
})
}
# AWS Pricing API access
resource "aws_iam_role_policy" "pricing_api_access" {
name = "airun-pathfinder-crud-pricing-pricing-api-policy"
role = aws_iam_role.lambda.id
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = [
"pricing:GetProducts",
"pricing:DescribeServices",
"pricing:GetAttributeValues"
]
Resource = "*"
}
]
})
}
# STS AssumeRole access (for Cost Explorer in customer accounts)
resource "aws_iam_role_policy" "sts_assume_role" {
name = "airun-pathfinder-crud-pricing-sts-policy"
role = aws_iam_role.lambda.id
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = "sts:AssumeRole"
Resource = "arn:aws:iam::*:role/pathfinder-pricing-access"
}
]
})
}
# Cost Explorer access (when assuming role)
# Note: This is granted via the role in the customer account, not here
# Local variables
locals {
table_name = var.table_name != "" ? var.table_name : "pathfinder-${var.environment}-pricing"