From 10f445c4bb482bc82266d2c5f9914f662ca1c2cb Mon Sep 17 00:00:00 2001 From: Dylan Ratcliffe Date: Mon, 14 Oct 2024 09:53:44 +0000 Subject: [PATCH 1/3] Removed static maps and move to go-native mapping Co-authored-by: David Schmitt --- extractmaps.go | 133 ---- tfutils/awssource.go | 1182 ----------------------------------- tfutils/k8ssource.go | 408 ------------ tfutils/plan_mapper.go | 240 ++++--- tfutils/plan_mapper_test.go | 107 +++- tfutils/types.go | 24 - 6 files changed, 215 insertions(+), 1879 deletions(-) delete mode 100644 extractmaps.go delete mode 100644 tfutils/awssource.go delete mode 100644 tfutils/k8ssource.go delete mode 100644 tfutils/types.go diff --git a/extractmaps.go b/extractmaps.go deleted file mode 100644 index 17e4ae16..00000000 --- a/extractmaps.go +++ /dev/null @@ -1,133 +0,0 @@ -//go:build ignore - -package main - -import ( - "encoding/json" - "fmt" - "html/template" - "os" - "strings" -) - -type Args struct { - Source string - SourceMunged string - Data map[string][]map[string]string -} - -func main() { - fmt.Printf("Running %s go on %s\n", os.Args[0], os.Getenv("GOFILE")) - - cwd, err := os.Getwd() - if err != nil { - panic(err) - } - fmt.Printf(" cwd = %s\n", cwd) - fmt.Printf(" os.Args = %#v\n", os.Args) - - for _, ev := range []string{"GOARCH", "GOOS", "GOFILE", "GOLINE", "GOPACKAGE", "DOLLAR"} { - fmt.Println(" ", ev, "=", os.Getenv(ev)) - } - - if len(os.Args) < 2 { - panic("Missing argument, aborting") - } - - args := Args{ - Source: os.Args[1], - SourceMunged: strings.ReplaceAll(os.Args[1], "-", ""), - Data: dataFromFiles(fmt.Sprintf("../sources/%v/docs-data", os.Args[1])), - } - - funcMap := template.FuncMap{ - "Title": strings.Title, - } - - template := template.New("simple").Funcs(funcMap) - template, err = template.Parse(`// Code generated by "extractmaps {{.Source}}"; DO NOT EDIT - -package tfutils - -import "github.com/overmindtech/sdp-go" - -var {{.SourceMunged | Title }}Data = map[string][]TfMapData{ -{{- range $key, $mappings := .Data}} - "{{$key}}": { {{- range $mappings}} - { - Type: "{{index . "type"}}", - Method: sdp.QueryMethod_{{index . "method"}}, - QueryField: "{{index . "query-field"}}", - Scope: "{{index . "scope"}}", - },{{end}} - },{{end}} -} -`) - if err != nil { - panic(err) - } - - f, err := os.Create(fmt.Sprintf("%v.go", strings.ToLower(args.SourceMunged))) - if err != nil { - panic(err) - } - defer f.Close() - - fmt.Printf("Generating handler for %v\n", args.Source) - err = template.Execute(f, args) - if err != nil { - panic(err) - } -} - -func dataFromFiles(path string) map[string][]map[string]string { - result := map[string][]map[string]string{} - entries, err := os.ReadDir(path) - if err != nil { - panic(err) - } - - for _, e := range entries { - if e.IsDir() { - continue - } - - if !strings.HasSuffix(e.Name(), ".json") { - continue - } - - fmt.Println(e.Name()) - contents, err := os.ReadFile(fmt.Sprintf("%v/%v", path, e.Name())) - if err != nil { - panic(err) - } - - var parsed map[string]any - err = json.Unmarshal(contents, &parsed) - if err != nil { - panic(err) - } - - queries, ok := parsed["terraformQuery"] - if !ok { - // skip if we don't have terraform query data - continue - } - for _, qAny := range queries.([]interface{}) { - q := qAny.(string) - data := map[string]string{ - "type": parsed["type"].(string), - } - - qSplit := strings.SplitN(q, ".", 2) - data["query-type"] = qSplit[0] - data["query-field"] = qSplit[1] - - data["scope"] = parsed["terraformScope"].(string) - data["method"] = parsed["terraformMethod"].(string) - - result[data["query-type"]] = append(result[data["query-type"]], data) - } - } - return result -} diff --git a/tfutils/awssource.go b/tfutils/awssource.go deleted file mode 100644 index 8ffc1ea6..00000000 --- a/tfutils/awssource.go +++ /dev/null @@ -1,1182 +0,0 @@ -// Code generated by "extractmaps aws-source"; DO NOT EDIT - -package tfutils - -import "github.com/overmindtech/sdp-go" - -var AwssourceData = map[string][]TfMapData{ - "aws_alb_listener": { - { - Type: "elbv2-listener", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_alb_listener_rule": { - { - Type: "elbv2-rule", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_alb_target_group": { - { - Type: "elbv2-target-group", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_ami": { - { - Type: "ec2-image", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_api_gateway_resource": { - { - Type: "apigateway-resource", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_api_gateway_rest_api": { - { - Type: "apigateway-rest-api", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_autoscaling_group": { - { - Type: "autoscaling-auto-scaling-group", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_cloudfront_Streamingdistribution": { - { - Type: "cloudfront-streaming-distribution", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_cloudfront_cache_policy": { - { - Type: "cloudfront-cache-policy", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_cloudfront_distribution": { - { - Type: "cloudfront-distribution", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_cloudfront_function": { - { - Type: "cloudfront-function", - Method: sdp.QueryMethod_GET, - QueryField: "name", - Scope: "*", - }, - }, - "aws_cloudfront_key_group": { - { - Type: "cloudfront-key-group", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_cloudfront_origin_access_control": { - { - Type: "cloudfront-origin-access-control", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_cloudfront_origin_request_policy": { - { - Type: "cloudfront-origin-request-policy", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_cloudfront_realtime_log_config": { - { - Type: "cloudfront-realtime-log-config", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_cloudfront_response_headers_policy": { - { - Type: "cloudfront-response-headers-policy", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_cloudwatch_metric_alarm": { - { - Type: "cloudwatch-alarm", - Method: sdp.QueryMethod_GET, - QueryField: "alarm_name", - Scope: "*", - }, - }, - "aws_db_instance": { - { - Type: "rds-db-instance", - Method: sdp.QueryMethod_GET, - QueryField: "identifier", - Scope: "*", - }, - }, - "aws_db_instance_role_association": { - { - Type: "rds-db-instance", - Method: sdp.QueryMethod_GET, - QueryField: "db_instance_identifier", - Scope: "*", - }, - }, - "aws_db_option_group": { - { - Type: "rds-option-group", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_db_parameter_group": { - { - Type: "rds-db-parameter-group", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_db_subnet_group": { - { - Type: "rds-db-subnet-group", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_default_route_table": { - { - Type: "ec2-route-table", - Method: sdp.QueryMethod_GET, - QueryField: "default_route_table_id", - Scope: "*", - }, - }, - "aws_dx_connection": { - { - Type: "directconnect-connection", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_dx_gateway": { - { - Type: "directconnect-direct-connect-gateway", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_dx_gateway_association": { - { - Type: "directconnect-direct-connect-gateway-association", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_dx_gateway_association_proposal": { - { - Type: "directconnect-direct-connect-gateway-association-proposal", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_dx_hosted_connection": { - { - Type: "directconnect-hosted-connection", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_dx_lag": { - { - Type: "directconnect-lag", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_dx_location": { - { - Type: "directconnect-location", - Method: sdp.QueryMethod_GET, - QueryField: "location_code", - Scope: "*", - }, - }, - "aws_dx_private_virtual_interface": { - { - Type: "directconnect-virtual-interface", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_dx_public_virtual_interface": { - { - Type: "directconnect-virtual-interface", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_dx_router_configuration": { - { - Type: "directconnect-router-configuration", - Method: sdp.QueryMethod_GET, - QueryField: "virtual_interface_id", - Scope: "*", - }, - }, - "aws_dx_transit_virtual_interface": { - { - Type: "directconnect-virtual-interface", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_dynamodb_table": { - { - Type: "dynamodb-table", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_ebs_volume": { - { - Type: "ec2-volume", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_ec2_capacity_reservation": { - { - Type: "ec2-capacity-reservation", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_ecs_capacity_provider": { - { - Type: "ecs-capacity-provider", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_ecs_cluster": { - { - Type: "ecs-cluster", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_ecs_service": { - { - Type: "ecs-service", - Method: sdp.QueryMethod_SEARCH, - QueryField: "cluster_name", - Scope: "*", - }, - }, - "aws_ecs_task_definition": { - { - Type: "ecs-task-definition", - Method: sdp.QueryMethod_GET, - QueryField: "family", - Scope: "*", - }, - }, - "aws_efs_access_point": { - { - Type: "efs-access-point", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_efs_backup_policy": { - { - Type: "efs-backup-policy", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_efs_file_system": { - { - Type: "efs-file-system", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_efs_mount_target": { - { - Type: "efs-mount-target", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_efs_replication_configuration": { - { - Type: "efs-replication-configuration", - Method: sdp.QueryMethod_GET, - QueryField: "source_file_system_id", - Scope: "*", - }, - }, - "aws_eip": { - { - Type: "ec2-address", - Method: sdp.QueryMethod_GET, - QueryField: "public_ip", - Scope: "*", - }, - }, - "aws_eip_association": { - { - Type: "ec2-address", - Method: sdp.QueryMethod_GET, - QueryField: "public_ip", - Scope: "*", - }, - }, - "aws_eks_addon": { - { - Type: "eks-addon", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_eks_cluster": { - { - Type: "eks-cluster", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_eks_fargate_profile": { - { - Type: "eks-fargate-profile", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_eks_node_group": { - { - Type: "eks-nodegroup", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_elb": { - { - Type: "elb-load-balancer", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_iam_group": { - { - Type: "iam-group", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_iam_instance_profile": { - { - Type: "iam-instance-profile", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_iam_policy": { - { - Type: "iam-policy", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_iam_role": { - { - Type: "iam-role", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_iam_user": { - { - Type: "iam-user", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_iam_user_policy_attachment": { - { - Type: "iam-policy", - Method: sdp.QueryMethod_SEARCH, - QueryField: "policy_arn", - Scope: "*", - }, - }, - "aws_instance": { - { - Type: "ec2-instance", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_internet_gateway": { - { - Type: "ec2-internet-gateway", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_key_pair": { - { - Type: "ec2-key-pair", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_kms_alias": { - { - Type: "kms-alias", - Method: sdp.QueryMethod_GET, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_kms_custom_key_store": { - { - Type: "kms-custom-key-store", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_kms_grant": { - { - Type: "kms-grant", - Method: sdp.QueryMethod_GET, - QueryField: "grant_id", - Scope: "*", - }, - }, - "aws_kms_key": { - { - Type: "kms-key", - Method: sdp.QueryMethod_GET, - QueryField: "key_id", - Scope: "*", - }, - }, - "aws_kms_key_policy": { - { - Type: "kms-key-policy", - Method: sdp.QueryMethod_GET, - QueryField: "key_id", - Scope: "*", - }, - }, - "aws_lambda_function": { - { - Type: "lambda-function", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_lambda_function_event_invoke_config": { - { - Type: "lambda-function", - Method: sdp.QueryMethod_SEARCH, - QueryField: "id", - Scope: "*", - }, - }, - "aws_lambda_function_url": { - { - Type: "lambda-function", - Method: sdp.QueryMethod_SEARCH, - QueryField: "function_arn", - Scope: "*", - }, - }, - "aws_lambda_layer_version": { - { - Type: "lambda-layer-version", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_launch_template": { - { - Type: "ec2-launch-template", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_lb": { - { - Type: "elbv2-load-balancer", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - { - Type: "elbv2-load-balancer", - Method: sdp.QueryMethod_SEARCH, - QueryField: "id", - Scope: "*", - }, - }, - "aws_lb_listener": { - { - Type: "elbv2-listener", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_lb_listener_rule": { - { - Type: "elbv2-rule", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_lb_target_group": { - { - Type: "elbv2-target-group", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_nat_gateway": { - { - Type: "ec2-nat-gateway", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_network_acl": { - { - Type: "ec2-network-acl", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_network_interface": { - { - Type: "ec2-network-interface", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_networkfirewall_firewall": { - { - Type: "network-firewall-firewall", - Method: sdp.QueryMethod_GET, - QueryField: "name", - Scope: "*", - }, - }, - "aws_networkfirewall_firewall_policy": { - { - Type: "network-firewall-firewall-policy", - Method: sdp.QueryMethod_GET, - QueryField: "name", - Scope: "*", - }, - }, - "aws_networkfirewall_rule_group": { - { - Type: "network-firewall-rule-group", - Method: sdp.QueryMethod_GET, - QueryField: "name", - Scope: "*", - }, - }, - "aws_networkmanager_connect_peer": { - { - Type: "networkmanager-connect-peer", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_networkmanager_connection": { - { - Type: "networkmanager-connection", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_networkmanager_core_network": { - { - Type: "networkmanager-connect-attachment", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - { - Type: "networkmanager-core-network", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_networkmanager_core_network_policy": { - { - Type: "networkmanager-core-network-policy", - Method: sdp.QueryMethod_GET, - QueryField: "core_network_id", - Scope: "*", - }, - }, - "aws_networkmanager_device": { - { - Type: "networkmanager-device", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_networkmanager_global_network": { - { - Type: "networkmanager-global-network", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_networkmanager_link": { - { - Type: "networkmanager-link", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_networkmanager_site": { - { - Type: "networkmanager-site", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_networkmanager_site_to_site_vpn_attachment": { - { - Type: "networkmanager-site-to-site-vpn-attachment", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_networkmanager_transit_gateway_peering": { - { - Type: "networkmanager-transit-gateway-peering", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_networkmanager_transit_gateway_route_table_attachment": { - { - Type: "networkmanager-transit-gateway-route-table-attachment", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_networkmanager_vpc_attachment": { - { - Type: "networkmanager-vpc-attachment", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_placement_group": { - { - Type: "ec2-placement-group", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_rds_cluster": { - { - Type: "rds-db-cluster", - Method: sdp.QueryMethod_GET, - QueryField: "cluster_identifier", - Scope: "*", - }, - }, - "aws_rds_cluster_parameter_group": { - { - Type: "rds-db-cluster-parameter-group", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_route": { - { - Type: "ec2-route-table", - Method: sdp.QueryMethod_GET, - QueryField: "route_table_id", - Scope: "*", - }, - }, - "aws_route53_health_check": { - { - Type: "route53-health-check", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_route53_hosted_zone_dnssec": { - { - Type: "route53-hosted-zone", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_route53_record": { - { - Type: "route53-resource-record-set", - Method: sdp.QueryMethod_SEARCH, - QueryField: "arn", - Scope: "*", - }, - { - Type: "route53-resource-record-set", - Method: sdp.QueryMethod_SEARCH, - QueryField: "id", - Scope: "*", - }, - }, - "aws_route53_zone": { - { - Type: "route53-hosted-zone", - Method: sdp.QueryMethod_GET, - QueryField: "zone_id", - Scope: "*", - }, - }, - "aws_route53_zone_association": { - { - Type: "route53-hosted-zone", - Method: sdp.QueryMethod_GET, - QueryField: "zone_id", - Scope: "*", - }, - }, - "aws_route_table": { - { - Type: "ec2-route-table", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_route_table_association": { - { - Type: "ec2-route-table", - Method: sdp.QueryMethod_GET, - QueryField: "route_table_id", - Scope: "*", - }, - { - Type: "ec2-subnet", - Method: sdp.QueryMethod_GET, - QueryField: "subnet_id", - Scope: "*", - }, - }, - "aws_s3_bucket": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_s3_bucket_acl": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_analytics_configuration": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_cors_configuration": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_intelligent_tiering_configuration": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_inventory": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_lifecycle_configuration": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_logging": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_metric": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_notification": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_object": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_object_lock_configuration": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_ownership_controls": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_policy": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_public_access_block": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_replication_configuration": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_request_payment_configuration": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_server_side_encryption_configuration": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_versioning": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_bucket_website_configuration": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_object": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_s3_object_copy": { - { - Type: "s3-bucket", - Method: sdp.QueryMethod_GET, - QueryField: "bucket", - Scope: "*", - }, - }, - "aws_security_group": { - { - Type: "ec2-security-group", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_security_group_rule": { - { - Type: "ec2-security-group-rule", - Method: sdp.QueryMethod_GET, - QueryField: "security_group_rule_id", - Scope: "*", - }, - { - Type: "ec2-security-group", - Method: sdp.QueryMethod_GET, - QueryField: "security_group_id", - Scope: "*", - }, - }, - "aws_sns_platform_application": { - { - Type: "sns-platform-application", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_sns_topic": { - { - Type: "sns-topic", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_sns_topic_data_protection_policy": { - { - Type: "sns-data-protection-policy", - Method: sdp.QueryMethod_GET, - QueryField: "arn", - Scope: "*", - }, - }, - "aws_sns_topic_subscription": { - { - Type: "sns-subscription", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_sqs_queue": { - { - Type: "sqs-queue", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_subnet": { - { - Type: "ec2-subnet", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_vpc": { - { - Type: "ec2-vpc", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_vpc_endpoint": { - { - Type: "ec2-vpc-endpoint", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_vpc_peering_connection": { - { - Type: "ec2-vpc-peering-connection", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_vpc_peering_connection_accepter": { - { - Type: "ec2-vpc-peering-connection", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, - "aws_vpc_peering_connection_options": { - { - Type: "ec2-vpc-peering-connection", - Method: sdp.QueryMethod_GET, - QueryField: "vpc_peering_connection_id", - Scope: "*", - }, - }, - "aws_vpc_security_group_egress_rule": { - { - Type: "ec2-security-group-rule", - Method: sdp.QueryMethod_GET, - QueryField: "security_group_rule_id", - Scope: "*", - }, - }, - "aws_vpc_security_group_ingress_rule": { - { - Type: "ec2-security-group-rule", - Method: sdp.QueryMethod_GET, - QueryField: "security_group_rule_id", - Scope: "*", - }, - }, - "egress_only_internet_gateway": { - { - Type: "ec2-egress-only-internet-gateway", - Method: sdp.QueryMethod_GET, - QueryField: "id", - Scope: "*", - }, - }, -} diff --git a/tfutils/k8ssource.go b/tfutils/k8ssource.go deleted file mode 100644 index 8549db62..00000000 --- a/tfutils/k8ssource.go +++ /dev/null @@ -1,408 +0,0 @@ -// Code generated by "extractmaps k8s-source"; DO NOT EDIT - -package tfutils - -import "github.com/overmindtech/sdp-go" - -var K8ssourceData = map[string][]TfMapData{ - "kubernetes_cluster_role_binding": { - { - Type: "ClusterRoleBinding", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}", - }, - }, - "kubernetes_cluster_role_binding_v1": { - { - Type: "ClusterRoleBinding", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}", - }, - }, - "kubernetes_cluster_role_v1": { - { - Type: "ClusterRole", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}", - }, - }, - "kubernetes_config_map": { - { - Type: "ConfigMap", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_config_map_v1": { - { - Type: "ConfigMap", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_cron_job": { - { - Type: "CronJob", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_cron_job_v1": { - { - Type: "CronJob", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_daemon_set_v1": { - { - Type: "DaemonSet", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_daemonset": { - { - Type: "DaemonSet", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_deployment": { - { - Type: "Deployment", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_deployment_v1": { - { - Type: "Deployment", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_endpoints": { - { - Type: "Endpoints", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_endpoints_slice_v1": { - { - Type: "EndpointSlice", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_endpoints_v1": { - { - Type: "Endpoints", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_horizontal_pod_autoscaler_v2": { - { - Type: "HorizontalPodAutoscaler", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_ingress_v1": { - { - Type: "Ingress", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_job": { - { - Type: "Job", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_job_v1": { - { - Type: "Job", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_limit_range": { - { - Type: "LimitRange", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_limit_range_v1": { - { - Type: "LimitRange", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_network_policy": { - { - Type: "NetworkPolicy", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_network_policy_v1": { - { - Type: "NetworkPolicy", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_node_taint": { - { - Type: "Node", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_persistent_volume": { - { - Type: "PersistentVolume", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_persistent_volume_claim": { - { - Type: "PersistentVolumeClaim", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_persistent_volume_claim_v1": { - { - Type: "PersistentVolumeClaim", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_persistent_volume_v1": { - { - Type: "PersistentVolume", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_pod": { - { - Type: "Pod", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_pod_disruption_budget_v1": { - { - Type: "PodDisruptionBudget", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_pod_v1": { - { - Type: "Pod", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_priority_class": { - { - Type: "PriorityClass", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_priority_class_v1": { - { - Type: "PriorityClass", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_replication_controller": { - { - Type: "ReplicationController", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_replication_controller_v1": { - { - Type: "ReplicationController", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_resource_quota": { - { - Type: "ResourceQuota", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_resource_quota_v1": { - { - Type: "ResourceQuota", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_role": { - { - Type: "Role", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_role_binding": { - { - Type: "RoleBinding", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_role_binding_v1": { - { - Type: "RoleBinding", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_role_v1": { - { - Type: "Role", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_secret": { - { - Type: "Secret", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_secret_v1": { - { - Type: "Secret", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_service": { - { - Type: "Service", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_service_account": { - { - Type: "ServiceAccount", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_service_account_v1": { - { - Type: "ServiceAccount", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_service_v1": { - { - Type: "Service", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_stateful_set": { - { - Type: "StatefulSet", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_stateful_set_v1": { - { - Type: "StatefulSet", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_storage_class": { - { - Type: "StorageClass", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, - "kubernetes_storage_class_v1": { - { - Type: "StorageClass", - Method: sdp.QueryMethod_GET, - QueryField: "metadata[0].name", - Scope: "${provider_mapping.cluster_name}.${values.metadata[0].namespace}", - }, - }, -} diff --git a/tfutils/plan_mapper.go b/tfutils/plan_mapper.go index 8051dc59..6215e340 100644 --- a/tfutils/plan_mapper.go +++ b/tfutils/plan_mapper.go @@ -11,6 +11,8 @@ import ( "github.com/getsentry/sentry-go" "github.com/google/uuid" + awsAdapters "github.com/overmindtech/aws-source/adapters" + k8sAdapters "github.com/overmindtech/k8s-source/adapters" "github.com/overmindtech/sdp-go" log "github.com/sirupsen/logrus" "google.golang.org/protobuf/types/known/structpb" @@ -95,6 +97,17 @@ func MappedItemDiffsFromPlanFile(ctx context.Context, fileName string, lf log.Fi return MappedItemDiffsFromPlan(ctx, planJSON, fileName, lf) } +type TfMapData struct { + // The overmind type name + OvermindType string + + // The method that the query should use + Method sdp.QueryMethod + + // The field within the resource that should be queried for + QueryField string +} + // MappedItemDiffsFromPlan takes a plan JSON, file name, and log fields as input // and returns the mapping results and an error. It parses the plan JSON, // extracts resource changes, and creates mapped item differences for each @@ -109,6 +122,35 @@ func MappedItemDiffsFromPlan(ctx context.Context, planJson []byte, fileName stri return nil, fmt.Errorf("'%v' appears to be a state file, not a plan file", fileName) } + // Load mapping data from the sources and convert into a map so that we can + // index by Terraform type + adapterMetadata := append(awsAdapters.Metadata.AllAdapterMetadata(), k8sAdapters.Metadata.AllAdapterMetadata()...) + // These mappings are from the terraform type, to required mapping data + mappings := make(map[string][]TfMapData) + for _, metadata := range adapterMetadata { + if metadata.GetType() == "" { + continue + } + + for _, mapping := range metadata.GetTerraformMappings() { + // Extract the query field and type from the mapping + subs := strings.SplitN(mapping.GetTerraformQueryMap(), ".", 2) + if len(subs) != 2 { + log.WithContext(ctx).WithFields(lf).WithField("terraform-query-map", mapping.GetTerraformQueryMap()).Warn("Skipping mapping with invalid query map") + continue + } + terraformType := subs[0] + queryField := subs[1] + + // Add the mapping details + mappings[terraformType] = append(mappings[terraformType], TfMapData{ + OvermindType: metadata.GetType(), + Method: mapping.GetTerraformMethod(), + QueryField: queryField, + }) + } + } + var plan Plan err := json.Unmarshal(planJson, &plan) if err != nil { @@ -132,13 +174,9 @@ func MappedItemDiffsFromPlan(ctx context.Context, planJson []byte, fileName stri return nil, fmt.Errorf("failed to create item diff for resource change: %w", err) } - // Load mappings for this type. These mappings tell us how to create an - // SDP query that will return this resource - awsMappings := AwssourceData[resourceChange.Type] - k8sMappings := K8ssourceData[resourceChange.Type] - mappings := append(awsMappings, k8sMappings...) - - if len(mappings) == 0 { + // Get the Terraform mappings for this specific type + relevantMappings, ok := mappings[resourceChange.Type] + if !ok { log.WithContext(ctx).WithFields(lf).WithField("terraform-address", resourceChange.Address).Debug("Skipping unmapped resource") results.Results = append(results.Results, PlannedChangeMapResult{ TerraformName: resourceChange.Address, @@ -152,152 +190,106 @@ func MappedItemDiffsFromPlan(ctx context.Context, planJson []byte, fileName stri continue } - for _, mapData := range mappings { - var currentResource *Resource + var currentResource *Resource - // Look for the resource in the prior values first, since this is - // the *previous* state we're like to be able to find it in the - // actual infra - if plan.PriorState.Values != nil { - currentResource = plan.PriorState.Values.RootModule.DigResource(resourceChange.Address) - } - - // If we didn't find it, look in the planned values - if currentResource == nil { - currentResource = plan.PlannedValues.RootModule.DigResource(resourceChange.Address) - } + // Look for the resource in the prior values first, since this is + // the *previous* state we're like to be able to find it in the + // actual infra + if plan.PriorState.Values != nil { + currentResource = plan.PriorState.Values.RootModule.DigResource(resourceChange.Address) + } - if currentResource == nil { - log.WithContext(ctx). - WithFields(lf). - WithField("terraform-address", resourceChange.Address). - WithField("terraform-query-field", mapData.QueryField).Warn("Skipping resource without values") - continue - } + // If we didn't find it, look in the planned values + if currentResource == nil { + currentResource = plan.PlannedValues.RootModule.DigResource(resourceChange.Address) + } - query, ok := currentResource.AttributeValues.Dig(mapData.QueryField) - if !ok { - log.WithContext(ctx). - WithFields(lf). - WithField("terraform-address", resourceChange.Address). - WithField("terraform-query-field", mapData.QueryField).Debug("Missing mapping field, cannot create Overmind query") - results.Results = append(results.Results, PlannedChangeMapResult{ - TerraformName: resourceChange.Address, - Status: MapStatusNotEnoughInfo, - Message: fmt.Sprintf("missing %v", mapData.QueryField), - MappedItemDiff: &sdp.MappedItemDiff{ - Item: itemDiff, - MappingQuery: nil, // unmapped item has no mapping query - }, - }) - continue - } + if currentResource == nil { + log.WithContext(ctx). + WithFields(lf). + WithField("terraform-address", resourceChange.Address). + Warn("Skipping resource without values") + continue + } - // Create the map that variables will pull data from - dataMap := make(map[string]any) - - // Populate resource values - dataMap["values"] = currentResource.AttributeValues - - if overmindMappingsOutput, ok := plan.PlannedValues.Outputs["overmind_mappings"]; ok { - configResource := plan.Config.RootModule.DigResource(resourceChange.Address) - - if configResource == nil { - log.WithContext(ctx). - WithFields(lf). - WithField("terraform-address", resourceChange.Address). - Debug("Skipping provider mapping for resource without config") - } else { - // Look up the provider config key in the mappings - mappings := make(map[string]map[string]string) - - err = json.Unmarshal(overmindMappingsOutput.Value, &mappings) - - if err != nil { - log.WithContext(ctx). - WithFields(lf). - WithField("terraform-address", resourceChange.Address). - WithError(err). - Error("Failed to parse overmind_mappings output") - } else { - // We need to split out the module section of the name - // here. If the resource isn't in a module, the - // ProviderConfigKey will be something like - // "kubernetes", however if it's in a module it's be - // something like "module.something:kubernetes" - providerName := extractProviderNameFromConfigKey(configResource.ProviderConfigKey) - currentProviderMappings, ok := mappings[providerName] - - if ok { - log.WithContext(ctx). - WithFields(lf). - WithField("terraform-address", resourceChange.Address). - WithField("provider-config-key", configResource.ProviderConfigKey). - Debug("Found provider mappings") - - // We have mappings for this provider, so set them - // in the `provider_mapping` value - dataMap["provider_mapping"] = currentProviderMappings - } - } - } - } + results.Results = append(results.Results, mapResourceToQuery(itemDiff, currentResource, relevantMappings)) + } - // Interpolate variables in the scope - scope, err := InterpolateScope(mapData.Scope, dataMap) + return &results, nil +} - if err != nil { - log.WithContext(ctx).WithError(err).Debugf("Could not find scope mapping variables %v, adding them will result in better results. Error: ", mapData.Scope) - scope = "*" - } +// Maps a resource to an Overmind query, or at least tries to given the provided +// mappings. If there are multiple valid queries, the first one will be used. +// +// In the future we might allow for multiple queries to be returned, this work +// will be tracked here: https://github.com/overmindtech/sdp/issues/272 +func mapResourceToQuery(itemDiff *sdp.ItemDiff, terraformResource *Resource, mappings []TfMapData) PlannedChangeMapResult { + attemptedMappings := make([]string, 0) + + if len(mappings) == 0 { + return PlannedChangeMapResult{ + TerraformName: terraformResource.Address, + Status: MapStatusUnsupported, + Message: "unsupported", + MappedItemDiff: &sdp.MappedItemDiff{ + Item: itemDiff, + MappingQuery: nil, // unmapped item has no mapping query + }, + } + } + for _, mapping := range mappings { + // See if the query field exists in the resource. If it doesn't then we + // will continue to the next mapping + query, ok := terraformResource.AttributeValues.Dig(mapping.QueryField) + if ok { + // If the query field exists, we will create a query u := uuid.New() newQuery := &sdp.Query{ - Type: mapData.Type, - Method: mapData.Method, + Type: mapping.OvermindType, + Method: mapping.Method, Query: fmt.Sprintf("%v", query), - Scope: scope, + Scope: "*", RecursionBehaviour: &sdp.Query_RecursionBehaviour{}, UUID: u[:], Deadline: timestamppb.New(time.Now().Add(60 * time.Second)), } - // cleanup item metadata from mapping query + // Set the type of item to the Overmind-supported type rather than + // the Terraform one if itemDiff.GetBefore() != nil { - itemDiff.Before.Type = newQuery.GetType() - if newQuery.GetScope() != "*" { - itemDiff.Before.Scope = newQuery.GetScope() - } + itemDiff.Before.Type = mapping.OvermindType } - - // cleanup item metadata from mapping query if itemDiff.GetAfter() != nil { - itemDiff.After.Type = newQuery.GetType() - if newQuery.GetScope() != "*" { - itemDiff.After.Scope = newQuery.GetScope() - } + itemDiff.After.Type = mapping.OvermindType } - results.Results = append(results.Results, PlannedChangeMapResult{ - TerraformName: resourceChange.Address, + return PlannedChangeMapResult{ + TerraformName: terraformResource.Address, Status: MapStatusSuccess, Message: "mapped", MappedItemDiff: &sdp.MappedItemDiff{ Item: itemDiff, MappingQuery: newQuery, }, - }) - - log.WithContext(ctx).WithFields(log.Fields{ - "scope": newQuery.GetScope(), - "type": newQuery.GetType(), - "query": newQuery.GetQuery(), - "method": newQuery.GetMethod().String(), - }).Debug("Mapped resource to query") + } } + + // It it wasn't successful, add the mapping to the list of attempted + // mappings + attemptedMappings = append(attemptedMappings, mapping.QueryField) } - return &results, nil + // If we get to this point, we haven't found a mapping + return PlannedChangeMapResult{ + TerraformName: terraformResource.Address, + Status: MapStatusNotEnoughInfo, + Message: fmt.Sprintf("missing mapping attribute: %v", strings.Join(attemptedMappings, ", ")), + MappedItemDiff: &sdp.MappedItemDiff{ + Item: itemDiff, + MappingQuery: nil, // unmapped item has no mapping query + }, + } } // Checks if the supplied JSON bytes are a state file. It's a common mistake to diff --git a/tfutils/plan_mapper_test.go b/tfutils/plan_mapper_test.go index f2d855de..2277218d 100644 --- a/tfutils/plan_mapper_test.go +++ b/tfutils/plan_mapper_test.go @@ -54,8 +54,8 @@ func TestMappedItemDiffsFromPlan(t *testing.T) { t.Errorf("Expected 16 secrets, got %v", results.RemovedSecrets) } - if len(results.Results) != 6 { - t.Errorf("Expected 6 changes, got %v:", len(results.Results)) + if len(results.Results) != 5 { + t.Errorf("Expected 5 changes, got %v:", len(results.Results)) for _, diff := range results.Results { t.Errorf(" %v", diff) } @@ -144,11 +144,11 @@ func TestMappedItemDiffsFromPlan(t *testing.T) { if api_server_deployment.GetMappingQuery().GetQuery() != "api-server" { t.Errorf("Expected api_server_deployment query to be 'api-server', got '%v'", api_server_deployment.GetMappingQuery().GetQuery()) } - if api_server_deployment.GetMappingQuery().GetScope() != "dogfood.default" { - t.Errorf("Expected api_server_deployment query scope to be 'dogfood.default', got '%v'", api_server_deployment.GetMappingQuery().GetScope()) + if api_server_deployment.GetMappingQuery().GetScope() != "*" { + t.Errorf("Expected api_server_deployment query scope to be '*', got '%v'", api_server_deployment.GetMappingQuery().GetScope()) } - if api_server_deployment.GetItem().GetBefore().GetScope() != "dogfood.default" { - t.Errorf("Expected api_server_deployment before item scope to be 'dogfood.default', got '%v'", api_server_deployment.GetItem().GetBefore().GetScope()) + if api_server_deployment.GetItem().GetBefore().GetScope() != "terraform_plan" { + t.Errorf("Expected api_server_deployment before item scope to be 'terraform_plan', got '%v'", api_server_deployment.GetItem().GetBefore().GetScope()) } if api_server_deployment.GetMappingQuery().GetType() != "Deployment" { t.Errorf("Expected api_server_deployment query type to be 'Deployment', got '%v'", api_server_deployment.GetMappingQuery().GetType()) @@ -195,8 +195,8 @@ func TestMappedItemDiffsFromPlan(t *testing.T) { if secret == nil { t.Fatalf("Expected secret to be set, but it's not") } - if secret.GetMappingQuery().GetScope() != "dogfood.default" { - t.Errorf("Expected secret query scope to be 'dogfood.default', got '%v'", secret.GetMappingQuery().GetScope()) + if secret.GetMappingQuery().GetScope() != "*" { + t.Errorf("Expected secret query scope to be '*', got '%v'", secret.GetMappingQuery().GetScope()) } // In a secret the "data" field is known after apply, but we don't *know* @@ -207,6 +207,97 @@ func TestMappedItemDiffsFromPlan(t *testing.T) { } } +func TestMapResourceToQuery(t *testing.T) { + type mapTest struct { + TestName string + Resource *Resource + Mappings []TfMapData + ExpectedQuery *sdp.Query + ExpectedStatus MapStatus + } + + deploymentResource := Resource{ + Address: "kubernetes_deployment.nats_box", + Mode: "managed", + Type: "kubernetes_deployment", + Name: "nats_box", + ProviderName: "kubernetes", + SchemaVersion: 0, + AttributeValues: AttributeValues{ + "metadata": []any{ + map[string]any{ + "namespace": "default", + "name": "nats-box", + }, + }, + }, + SensitiveValues: json.RawMessage{}, + } + + tests := []mapTest{ + { + TestName: "nested k8s deployment", + ExpectedQuery: &sdp.Query{ + Type: "Deployment", + Query: "nats-box", + }, + ExpectedStatus: MapStatusSuccess, + Resource: &deploymentResource, + Mappings: []TfMapData{ + { + OvermindType: "Deployment", + Method: sdp.QueryMethod_GET, + QueryField: "metadata[0].name", + }, + }, + }, + { + TestName: "with no mappings", + Resource: &deploymentResource, + Mappings: []TfMapData{}, + ExpectedQuery: nil, + ExpectedStatus: MapStatusUnsupported, + }, + { + TestName: "with mappings that don't work", + Resource: &deploymentResource, + Mappings: []TfMapData{ + { + OvermindType: "Deployment", + Method: sdp.QueryMethod_GET, + QueryField: "metadata[0].foo", + }, + }, + ExpectedQuery: nil, + ExpectedStatus: MapStatusNotEnoughInfo, + }, + } + + for _, test := range tests { + t.Run(test.TestName, func(t *testing.T) { + result := mapResourceToQuery(nil, test.Resource, test.Mappings) + + if result.Status != test.ExpectedStatus { + t.Errorf("Expected status to be %v, got %v", test.ExpectedStatus, result.Status) + } + + if test.ExpectedQuery != nil { + if result.MappedItemDiff == nil { + t.Errorf("Expected mapped item diff to be set, but it's not") + } + + if result.MappedItemDiff.GetMappingQuery().GetType() != test.ExpectedQuery.GetType() { + t.Errorf("Expected type to be %v, got %v", test.ExpectedQuery.GetType(), result.MappedItemDiff.GetMappingQuery().GetType()) + } + + if result.MappedItemDiff.GetMappingQuery().GetQuery() != test.ExpectedQuery.GetQuery() { + t.Errorf("Expected query to be %v, got %v", test.ExpectedQuery.GetQuery(), result.MappedItemDiff.GetMappingQuery().GetQuery()) + } + } + }) + } +} + func TestPlanMappingResultNumFuncs(t *testing.T) { result := PlanMappingResult{ Results: []PlannedChangeMapResult{ diff --git a/tfutils/types.go b/tfutils/types.go deleted file mode 100644 index df2bd41d..00000000 --- a/tfutils/types.go +++ /dev/null @@ -1,24 +0,0 @@ -package tfutils - -import ( - "github.com/overmindtech/sdp-go" -) - -//go:generate go run ../extractmaps.go aws-source -//go:generate go run ../extractmaps.go k8s-source - -type TfMapData struct { - // The overmind type name - Type string - - // The method that the query should use - Method sdp.QueryMethod - - // The field within the resource that should be queried for - QueryField string - - // The scope for the query. This can be either `*`, `global` or a string - // that includes interpolations in Terraform format i.e. - // ${outputs.overmind_kubernetes_cluster_name}.${values.metadata.namespace} - Scope string -} From 309f79ef944872c1c8c66bac08767d15431fd2bf Mon Sep 17 00:00:00 2001 From: Dylan Ratcliffe Date: Mon, 14 Oct 2024 09:57:21 +0000 Subject: [PATCH 2/3] Update dependencies --- go.mod | 33 ++++++++++++++++- go.sum | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 140 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index ed20655a..d7a8c5ff 100644 --- a/go.mod +++ b/go.mod @@ -22,8 +22,9 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/muesli/reflow v0.3.0 github.com/muesli/termenv v0.15.3-0.20240912151726-82936c5ea257 - github.com/overmindtech/aws-source v0.0.0-20241011124832-50dd83357182 - github.com/overmindtech/discovery v0.29.1 + github.com/overmindtech/aws-source v0.0.0-20241013114238-805a0284616e + github.com/overmindtech/discovery v0.29.2 + github.com/overmindtech/k8s-source v0.8.1-0.20241014091924-29f94c7c602c github.com/overmindtech/pterm v0.0.0-20240919144758-04d94ccb2297 github.com/overmindtech/sdp-go v0.96.0 github.com/overmindtech/stdlib-source v0.0.0-20241011092854-dc393bdb00c3 @@ -104,28 +105,43 @@ require ( github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dlclark/regexp2 v1.11.0 // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/jsonpointer v0.20.0 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/swag v0.22.4 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/btree v1.1.3 // indirect + github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.6.0 // indirect + github.com/google/gofuzz v1.2.0 // indirect github.com/gookit/color v1.5.4 // indirect github.com/gorilla/css v1.0.1 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.9 // indirect github.com/lithammer/fuzzysearch v1.1.8 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/magiconair/properties v1.8.7 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/micahhausler/aws-iam-policy v0.4.2 // indirect github.com/microcosm-cc/bluemonday v1.0.27 // indirect github.com/miekg/dns v1.1.62 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/nats-io/jwt/v2 v2.7.2 // indirect github.com/nats-io/nats.go v1.37.0 // indirect github.com/nats-io/nkeys v0.4.7 // indirect @@ -142,6 +158,7 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/uptrace/opentelemetry-go-extra/otelutil v0.3.1 // indirect + github.com/x448/float16 v0.8.4 // indirect github.com/xhit/go-str2duration/v2 v2.1.0 // indirect github.com/xiam/to v0.0.0-20200126224905-d60d31e03561 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect @@ -158,10 +175,22 @@ require ( golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.6.0 // indirect golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/grpc v1.66.1 // indirect gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + k8s.io/api v0.31.1 // indirect + k8s.io/apimachinery v0.31.1 // indirect + k8s.io/client-go v0.31.1 // indirect + k8s.io/klog/v2 v2.130.1 // indirect + k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect + k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index 7c36e128..b0ffc5b6 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,8 @@ atomicgo.dev/schedule v0.1.0 h1:nTthAbhZS5YZmgYbb2+DH8uQIZcTlIrd4eYr3UQxEjs= atomicgo.dev/schedule v0.1.0/go.mod h1:xeUa3oAkiuHYh8bKiQBRojqAMq3PXXbJujjb0hw8pEU= connectrpc.com/connect v1.17.0 h1:W0ZqMhtVzn9Zhn2yATuUokDLO5N+gIuBWMOnsQrfmZk= connectrpc.com/connect v1.17.0/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8= +github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= +github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs= github.com/MarvinJWendt/testza v0.2.1/go.mod h1:God7bhG8n6uQxwdScay+gjm9/LnO4D3kkcZX4hv9Rp8= github.com/MarvinJWendt/testza v0.2.8/go.mod h1:nwIcjmr0Zz+Rcwfh3/4UhBp7ePKVhuBExvZqnKYWlII= @@ -33,6 +35,8 @@ github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +github.com/alessio/shellescape v1.4.2 h1:MHPfaU+ddJ0/bYWpgIeUnQUqKrlJ1S7BfEYPM4uEoM0= +github.com/alessio/shellescape v1.4.2/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk= @@ -142,18 +146,25 @@ github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkX github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= +github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/getsentry/sentry-go v0.29.0 h1:YtWluuCFg9OfcqnaujpY918N/AhCCwarIDWOYSBAjCA= github.com/getsentry/sentry-go v0.29.0/go.mod h1:jhPesDAL0Q0W2+2YEuVOvdWmVtdsr1+jtBrlDEVWwLY= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= @@ -165,12 +176,36 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= +github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/safetext v0.0.0-20230106111101-7156a760e523 h1:i4NsbmB9pD5+Ggp5GZKyvYY6MkjvPE8CIMlkvXFF8gA= +github.com/google/safetext v0.0.0-20230106111101-7156a760e523/go.mod h1:mJNEy0r5YPHC7ChQffpOszlGB4L1iqjXWpIEKcFpr9s= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= @@ -191,6 +226,8 @@ github.com/hashicorp/terraform-config-inspect v0.0.0-20240801114854-6714b46f5fe4 github.com/hashicorp/terraform-config-inspect v0.0.0-20240801114854-6714b46f5fe4/go.mod h1:Gz/z9Hbn+4KSp8A2FBtNszfLSdT2Tn/uAKGuVqqWmDI= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= +github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= +github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jarcoal/httpmock v1.3.0 h1:2RJ8GP0IIaWwcC9Fp2BmVi8Kog3v2Hn7VXM3fTd+nuc= @@ -201,6 +238,12 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= @@ -209,6 +252,7 @@ github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuOb github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y70BU= github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -221,6 +265,8 @@ github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69 github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= @@ -241,10 +287,17 @@ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQ github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.15.3-0.20240912151726-82936c5ea257 h1:RNw/zu+CJemcRlDFPjElZUbY2UlI/MA2B3I6PM3Isiw= github.com/muesli/termenv v0.15.3-0.20240912151726-82936c5ea257/go.mod h1:hxSnBBYLK21Vtq/PHd0S2FYCxBXzBua8ov5s1RobyRQ= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/nats-io/jwt/v2 v2.7.2 h1:SCRjfDLJ2q8naXp8YlGJJS5/yj3wGSODFYVi4nnwVMw= github.com/nats-io/jwt/v2 v2.7.2/go.mod h1:kB6QUmqHG6Wdrzj0KP2L+OX4xiTPBeV+NHVstFaATXU= github.com/nats-io/nats-server/v2 v2.10.21 h1:gfG6T06wBdI25XyY2IsauarOc2srWoFxxfsOKjrzoRA= @@ -255,12 +308,18 @@ github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI= github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/openrdap/rdap v0.9.2-0.20240517203139-eb57b3a8dedd h1:UuQycBx6K0lB0/IfHePshOYjlrptkF4FoApFP2Y4s3k= github.com/openrdap/rdap v0.9.2-0.20240517203139-eb57b3a8dedd/go.mod h1:391Ww1JbjG4FHOlvQqCd6n25CCCPE64JzC5cCYPxhyM= -github.com/overmindtech/aws-source v0.0.0-20241011124832-50dd83357182 h1:k3zVUoVWllE4dCIcqJgVoL5cjJEDckKVOpYZvE8P3XM= -github.com/overmindtech/aws-source v0.0.0-20241011124832-50dd83357182/go.mod h1:AZ5Sq17GpZbIsAX4sMIhs+er0hqRrcJBYJDCdZ3Cfyg= -github.com/overmindtech/discovery v0.29.1 h1:QoEtsiEjuoDCAMZRYtfNhqaF1nL3lzzSCByJzEYVdMs= -github.com/overmindtech/discovery v0.29.1/go.mod h1:WzTpStMxdAhsjSU5EP+2iRsMIKQWSJiVS5wzJ/mRatA= +github.com/overmindtech/aws-source v0.0.0-20241013114238-805a0284616e h1:Lm4ZuqGZMPLWQhMQ7PMLWx/3j4wUl3aKjyHd57LRtRU= +github.com/overmindtech/aws-source v0.0.0-20241013114238-805a0284616e/go.mod h1:/7/Z6VwIcc42ECPkOz23D7057htcLZiuPa7u1NyjFwI= +github.com/overmindtech/discovery v0.29.2 h1:bRCaWG8T9RfgVURwvrP86XMTjXhP5RXXvMKx9FTLYEA= +github.com/overmindtech/discovery v0.29.2/go.mod h1:MUDUqB0vM7xJ9wQdpyNWFPmqtXNjh6QfYhQ4g7QIRmU= +github.com/overmindtech/k8s-source v0.8.1-0.20241014091924-29f94c7c602c h1:zWB0MSS14nBAZw79Y0XoBOHYGf6oGXb1cKEvk80hyPQ= +github.com/overmindtech/k8s-source v0.8.1-0.20241014091924-29f94c7c602c/go.mod h1:MjyP5ZljcZ2HSVRZ2nBrxM3zyjkgvtvnXz7i4OHSJQQ= github.com/overmindtech/pterm v0.0.0-20240919144758-04d94ccb2297 h1:ih4bqBMHTCtg3lMwJszNkMGO9n7Uoe0WX5be1/x+s+g= github.com/overmindtech/pterm v0.0.0-20240919144758-04d94ccb2297/go.mod h1:bRQZYnvLrW1S5wYT6tbQnun8NpO5X6zP5cY3VKuDc4U= github.com/overmindtech/sdp-go v0.96.0 h1:4rgO8VSkS4Kh/Yv8IluFrXD5c7rU2rgACO/xLh6QLII= @@ -269,6 +328,8 @@ github.com/overmindtech/sdpcache v1.6.4 h1:MJoYBDqDE3s8FrRzZ0RPgFiH39HWI/Mv2ImH1 github.com/overmindtech/sdpcache v1.6.4/go.mod h1:/F9XStVdntRJEQjlZ86BPuB1Y7VPo1PFcsCNiU1IoGE= github.com/overmindtech/stdlib-source v0.0.0-20241011092854-dc393bdb00c3 h1:j4tvVq0snSldAgx7wZptqMZ2L7rP3IjokFZLaIpAKb8= github.com/overmindtech/stdlib-source v0.0.0-20241011092854-dc393bdb00c3/go.mod h1:d5VNKgUZ6/h+V3Y6xUPY8CGHWX8Hkks/ajyP/DdNXDI= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= @@ -320,11 +381,13 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= @@ -336,6 +399,8 @@ github.com/uptrace/opentelemetry-go-extra/otellogrus v0.3.1 h1:sApVqiPa+lFhsIzRE github.com/uptrace/opentelemetry-go-extra/otellogrus v0.3.1/go.mod h1:y5+uFBQU6m6ZUexR31pR0OTYDCrJ735Du/y3aAuYlzs= github.com/uptrace/opentelemetry-go-extra/otelutil v0.3.1 h1:Suvl9fe12MM0oi8/rcGxlGd7XawNQawU369aHzZFFec= github.com/uptrace/opentelemetry-go-extra/otelutil v0.3.1/go.mod h1:aiX/F5+EYbY2ed2OQEYRXzMcNGvI9pip5gW2ZtBDers= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= github.com/xiam/dig v0.0.0-20191116195832-893b5fb5093b h1:ajy6PPLDeQaf7xf4P/4Ie/wsUTEqjy3Irl+xFelmjk0= @@ -346,6 +411,8 @@ github.com/xiam/to v0.0.0-20200126224905-d60d31e03561/go.mod h1:cqbG7phSzrbdg3aj github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg= @@ -385,16 +452,23 @@ go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= @@ -403,11 +477,15 @@ golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -440,11 +518,16 @@ golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= @@ -459,6 +542,8 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/go-jose/go-jose.v2 v2.6.3 h1:nt80fvSDlhKWQgSWyHyy5CfmlQr+asih51R8PTWNKKs= gopkg.in/go-jose/go-jose.v2 v2.6.3/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -470,3 +555,23 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.31.1 h1:Xe1hX/fPW3PXYYv8BlozYqw63ytA92snr96zMW9gWTU= +k8s.io/api v0.31.1/go.mod h1:sbN1g6eY6XVLeqNsZGLnI5FwVseTrZX7Fv3O26rhAaI= +k8s.io/apimachinery v0.31.1 h1:mhcUBbj7KUjaVhyXILglcVjuS4nYXiwC+KKFBgIVy7U= +k8s.io/apimachinery v0.31.1/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/client-go v0.31.1 h1:f0ugtWSbWpxHR7sjVpQwuvw9a3ZKLXX0u0itkFXufb0= +k8s.io/client-go v0.31.1/go.mod h1:sKI8871MJN2OyeqRlmA4W4KM9KBdBUpDLu/43eGemCg= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/kind v0.24.0 h1:g4y4eu0qa+SCeKESLpESgMmVFBebL0BDa6f777OIWrg= +sigs.k8s.io/kind v0.24.0/go.mod h1:t7ueEpzPYJvHA8aeLtI52rtFftNgUYUaCwvxjk7phfw= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= From 8301fbf4914aa1158ba045209371dfe80298022b Mon Sep 17 00:00:00 2001 From: Dylan Ratcliffe Date: Mon, 14 Oct 2024 10:02:59 +0000 Subject: [PATCH 3/3] Removed steps that pull in sources for tests & build --- .github/actions/go_init/action.yml | 34 ------------------------------ sources/aws-source | 1 - sources/k8s-source | 1 - 3 files changed, 36 deletions(-) delete mode 120000 sources/aws-source delete mode 120000 sources/k8s-source diff --git a/.github/actions/go_init/action.yml b/.github/actions/go_init/action.yml index 161da28c..90bfbde1 100644 --- a/.github/actions/go_init/action.yml +++ b/.github/actions/go_init/action.yml @@ -15,40 +15,6 @@ runs: check-latest: true cache: ${{ inputs.cache }} - - name: Checkout - uses: actions/checkout@v4 - with: - repository: overmindtech/aws-source - path: ./aws-source - - - name: Checkout - uses: actions/checkout@v4 - with: - repository: overmindtech/k8s-source - path: ./k8s-source - - - name: Move sources in place - shell: bash - run: | - rm -rf ../aws-source - rm -rf ../k8s-source - mv -v aws-source .. - mv -v k8s-source .. - - - name: Install Docgen - shell: bash - run: go install github.com/overmindtech/docgen@latest - - - name: Go Generate for sources - shell: bash - run: | - cd ../aws-source - go generate ./... - cd - - cd ../k8s-source - go generate ./... - cd - - - name: Go Generate shell: bash run: | diff --git a/sources/aws-source b/sources/aws-source deleted file mode 120000 index 1f473996..00000000 --- a/sources/aws-source +++ /dev/null @@ -1 +0,0 @@ -../../aws-source/ \ No newline at end of file diff --git a/sources/k8s-source b/sources/k8s-source deleted file mode 120000 index 0eb6d8a8..00000000 --- a/sources/k8s-source +++ /dev/null @@ -1 +0,0 @@ -../../k8s-source/ \ No newline at end of file