mirror of
https://github.com/floci-io/floci.git
synced 2026-11-28 08:09:43 -05:00
* test(terraform): expand Floci IaC compatibility coverage * fix(terraform): use current S3 backend path style option * fix(terraform): route ElastiCache provider calls to Floci * fix(compat): resolve Firehose name collision, drop resources with live Floci gaps - aws_kinesis_firehose_delivery_stream.compat collided with main's .events stream (both named floci-compat-firehose); renamed to floci-compat-firehose-basic. - Removed aws_codebuild_project, aws_cloudtrail, and aws_opensearch_domain from both suites: running the suite end-to-end surfaced real Floci gaps behind them (BatchGetProjects ARN lookup, CloudTrail ListTags, OpenSearch CognitoOptions nil deref crashing the provider) that only show once Terraform gets past apply into the post-create refresh. Tracked as #2799, #2800, #2801. - Updated test counts in README to match (70/44/2,582). * fix(compat): force_destroy the compat bucket, drop resources with live teardown gaps - aws_s3_bucket.app now sets force_destroy = true: the CUR report now actually emits into this bucket (format=Parquet finally lets the report definition get created), so terraform destroy needs to be able to clear a non-empty bucket. - Removed aws_transfer_server: Floci's DeleteServer wrongly requires OFFLINE state, which isn't real AWS behavior (confirmed against the API reference and terraform-provider-aws's own delete logic, which never calls StopServer first). Tracked as #2802. - Removed aws_batch_compute_environment: UpdateComputeEnvironment (called by terraform destroy to disable it first) isn't implemented at all, so the request falls through to an HTML error page instead of a modeled error. Tracked as #2803. - Updated test counts in README to match (68/42/2,578). * fix(compat): drop aws_api_gateway_rest_api pending Floci apiStatus fix CI (native / compat-terraform) showed terraform apply deterministically timing out on aws_api_gateway_rest_api: terraform-provider-aws waits for the REST API's apiStatus field to reach AVAILABLE, and Floci never sets it (confirmed apiStatus is a real, current field in the apigateway wire model). Removed from both suites; tracked as #2804. Updated test counts in README to match (67/41/2,576). * fix(compat): drop redundant ECS containerInsights setting causing drift CreateCluster silently drops the settings field on Floci (confirmed: handleCreateCluster never parses req.path("settings"), unlike the update handlers), so a subsequent plan always proposes re-adding it - permanent drift on the suite's "re-planning reports no changes" check. containerInsights=disabled is AWS's actual default, so the block was functionally redundant; dropped it rather than block on a Java fix. Tracked as #2806. --------- Co-authored-by: Priamo <pgermosen@gmail.com>
72 lines
2.3 KiB
Bash
72 lines
2.3 KiB
Bash
#!/usr/bin/env bash
|
|
# Common setup for Terraform bats tests
|
|
|
|
TF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
|
|
# Load bats helpers - support both local and Docker environments
|
|
if [[ -d "${TF_DIR}/../lib/bats-support" ]]; then
|
|
load "${TF_DIR}/../lib/bats-support/load"
|
|
load "${TF_DIR}/../lib/bats-assert/load"
|
|
elif [[ -d "${TF_DIR}/lib/bats-support" ]]; then
|
|
load "${TF_DIR}/lib/bats-support/load"
|
|
load "${TF_DIR}/lib/bats-assert/load"
|
|
elif [[ -n "${BATS_LIB_PATH:-}" ]]; then
|
|
load "${BATS_LIB_PATH}/bats-support/load"
|
|
load "${BATS_LIB_PATH}/bats-assert/load"
|
|
else
|
|
echo "Error: Cannot find bats-support/bats-assert libraries" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Shared test helpers kept local to this module so Docker and local runs behave the same.
|
|
export FLOCI_ENDPOINT="${FLOCI_ENDPOINT:-http://localhost:4566}"
|
|
export AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION:-us-east-1}"
|
|
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-test}"
|
|
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-test}"
|
|
export AWS_ENDPOINT_URL="$FLOCI_ENDPOINT"
|
|
|
|
aws_cmd() {
|
|
aws --endpoint-url "$FLOCI_ENDPOINT" --region "$AWS_DEFAULT_REGION" --output json "$@"
|
|
}
|
|
|
|
json_get() {
|
|
local json="$1"
|
|
local path="$2"
|
|
echo "$json" | jq -r "$path" 2>/dev/null || echo ""
|
|
}
|
|
|
|
# Terraform-specific helpers
|
|
create_state_backend() {
|
|
# Create S3 state bucket if not exists
|
|
if ! aws_cmd s3api head-bucket --bucket tfstate 2>/dev/null; then
|
|
aws_cmd s3api create-bucket --bucket tfstate
|
|
fi
|
|
|
|
# Create DynamoDB lock table if not exists
|
|
if ! aws_cmd dynamodb describe-table --table-name tflock 2>/dev/null | grep -q ACTIVE; then
|
|
aws_cmd dynamodb create-table \
|
|
--table-name tflock \
|
|
--attribute-definitions AttributeName=LockID,AttributeType=S \
|
|
--key-schema AttributeName=LockID,KeyType=HASH \
|
|
--billing-mode PAY_PER_REQUEST
|
|
fi
|
|
}
|
|
|
|
generate_backend_config() {
|
|
cat > /tmp/floci-backend.hcl <<EOF
|
|
bucket = "tfstate"
|
|
key = "floci-compat.tfstate"
|
|
region = "us-east-1"
|
|
|
|
endpoint = "${FLOCI_ENDPOINT}"
|
|
access_key = "test"
|
|
secret_key = "test"
|
|
skip_credentials_validation = true
|
|
skip_region_validation = true
|
|
use_path_style = true
|
|
|
|
dynamodb_endpoint = "${FLOCI_ENDPOINT}"
|
|
dynamodb_table = "tflock"
|
|
EOF
|
|
}
|