klothoplatform / klotho

Klotho - write AWS applications at lightning speed
https://klo.dev
Apache License 2.0
1.12k stars 38 forks source link

engine errors return false positives #971

Open jhsinger-klotho opened 5 months ago

jhsinger-klotho commented 5 months ago

this is likely because we are looking for errors in property vertex evaluation, but sometimes we dont evaluate in order so that assumption is broken.

repro

[
  {
    "error": {
      "chain": [
        "required property AutoScalingGroupProvider.AutoScalingGroupArn is not set on resource aws:ecs_capacity_provider:stackpacks-capacity-provider"
      ]
    },
    "error_code": "config_invalid",
    "property": "AutoScalingGroupProvider.AutoScalingGroupArn",
    "resource": "aws:ecs_capacity_provider:stackpacks-capacity-provider",
    "validation_error": "required property AutoScalingGroupProvider.AutoScalingGroupArn is not set on resource aws:ecs_capacity_provider:stackpacks-capacity-provider",
    "value": null
  },
  {
    "error": {
      "chain": [
        "required property Cluster is not set on resource aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider"
      ]
    },
    "error_code": "config_invalid",
    "property": "Cluster",
    "resource": "aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider",
    "validation_error": "required property Cluster is not set on resource aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider",
    "value": null
  },
  {
    "error": {
      "chain": [
        "required property CapacityProviders is not set on resource aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider"
      ]
    },
    "error_code": "config_invalid",
    "property": "CapacityProviders",
    "resource": "aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider",
    "validation_error": "required property CapacityProviders is not set on resource aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider",
    "value": null
  },
  {
    "error": {
      "chain": [
        "required property DefaultCapacityProviderStrategy is not set on resource aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider"
      ]
    },
    "error_code": "config_invalid",
    "property": "DefaultCapacityProviderStrategy",
    "resource": "aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider",
    "validation_error": "required property DefaultCapacityProviderStrategy is not set on resource aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider",
    "value": null
  }
]

constraints

constraints:
- node: aws:ecr_image:mattermost
  operator: must_exist
  scope: application
- node: aws:ecs_service:mattermost-service
  operator: must_exist
  scope: application
- node: aws:ecs_task_definition:mattermost-task
  operator: must_exist
  scope: application
- node: aws:load_balancer:mattermost-lb
  operator: must_exist
  scope: application
- node: aws:rds_instance:mattermost-db
  operator: must_exist
  scope: application
- node: aws:efs_file_system:mattermost-efs
  operator: must_exist
  scope: application
- node: aws:cloudfront_distribution:mattermost-cf
  operator: must_exist
  scope: application
- operator: equals
  property: BaseImage
  scope: resource
  target: aws:ecr_image:mattermost
  value: mattermost/mattermost-team-edition:8.1
- operator: equals
  property: Dockerfile
  scope: resource
  target: aws:ecr_image:mattermost
  value: Dockerfile
- operator: equals
  property: LoadBalancers[0].ContainerPort
  scope: resource
  target: aws:ecs_service:mattermost-service
  value: 8065
- operator: equals
  property: TaskDefinition
  scope: resource
  target: aws:ecs_service:mattermost-service
  value: aws:ecs_task_definition:mattermost-task
- operator: equals
  property: Cpu
  scope: resource
  target: aws:ecs_task_definition:mattermost-task
  value: 512
- operator: equals
  property: Memory
  scope: resource
  target: aws:ecs_task_definition:mattermost-task
  value: 2048
- operator: equals
  property: ContainerDefinitions
  scope: resource
  target: aws:ecs_task_definition:mattermost-task
  value:
  - Cpu: 512
    Environment:
    - Name: MATTERMOST_CONFIG_PATH
      Value: /mnt/efs/mattermost/config
    - Name: MATTERMOST_DATA_PATH
      Value: /mnt/efs/mattermost/data
    - Name: MATTERMOST_LOGS_PATH
      Value: /mnt/efs/mattermost/logs
    - Name: MATTERMOST_PLUGINS_PATH
      Value: /mnt/efs/mattermost/plugins
    - Name: MATTERMOST_CLIENT_PLUGINS_PATH
      Value: /mnt/efs/mattermost/client/plugins
    - Name: MM_SQLSETTINGS_DRIVERNAME
      Value: postgres
    - Name: MM_DB_NAME
      Value: aws:rds_instance:mattermost-db#DatabaseName
    Image: aws:ecr_image:mattermost
    Memory: 2048
    Name: mattermost
    PortMappings:
    - ContainerPort: 8065
      HostPort: 8065
- operator: equals
  property: Scheme
  scope: resource
  target: aws:load_balancer:mattermost-lb
  value: internet-facing
- operator: must_exist
  scope: edge
  target:
    source: aws:cloudfront_distribution:mattermost-cf
    target: aws:load_balancer:mattermost-lb
- operator: must_exist
  scope: edge
  target:
    source: aws:load_balancer:mattermost-lb
    target: aws:ecs_service:mattermost-service
- operator: must_exist
  scope: edge
  target:
    source: aws:ecs_service:mattermost-service
    target: aws:rds_instance:mattermost-db
- operator: must_exist
  scope: edge
  target:
    source: aws:ecs_service:mattermost-service
    target: aws:efs_file_system:mattermost-efs
- node: aws:ecs_capacity_provider:stackpacks-capacity-provider
  operator: import
  scope: application
- node: aws:ecs_cluster:stackpacks-ecs-cluster
  operator: import
  scope: application
- node: aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider
  operator: import
  scope: application
- node: aws:region:default_5_43_0
  operator: import
  scope: application
- node: aws:subnet:stackpacks-private-subnet-1
  operator: import
  scope: application
- node: aws:subnet:stackpacks-private-subnet-2
  operator: import
  scope: application
- node: aws:subnet:stackpacks-public-subnet-1
  operator: import
  scope: application
- node: aws:subnet:stackpacks-public-subnet-2
  operator: import
  scope: application
- node: aws:vpc:stackpacks-vpc
  operator: import
  scope: application
- node: aws:region:region
  operator: import
  scope: application
- node: aws:availability_zone:region:az1
  operator: import
  scope: application
- node: aws:availability_zone:region:az2
  operator: import
  scope: application
- operator: equals
  property: Arn
  scope: resource
  target: aws:ecs_capacity_provider:stackpacks-capacity-provider
  value: arn:aws:ecs:eu-central-1:064389020595:capacity-provider/stackpacks-capacity-provider-1da47ea
- operator: equals
  property: Id
  scope: resource
  target: aws:ecs_capacity_provider:stackpacks-capacity-provider
  value: stackpacks-capacity-provider-1da47ea
- operator: equals
  property: Tags.GlobalKlothoTag
  scope: resource
  target: aws:ecs_capacity_provider:stackpacks-capacity-provider
  value: ''
- operator: equals
  property: Tags.ResourceName
  scope: resource
  target: aws:ecs_capacity_provider:stackpacks-capacity-provider
  value: stackpacks-capacity-provider
- operator: equals
  property: Arn
  scope: resource
  target: aws:ecs_cluster:stackpacks-ecs-cluster
  value: arn:aws:ecs:eu-central-1:064389020595:cluster/stackpacks-ecs-cluster-5aff420
- operator: equals
  property: Id
  scope: resource
  target: aws:ecs_cluster:stackpacks-ecs-cluster
  value: stackpacks-ecs-cluster-5aff420
- operator: equals
  property: Tags.GlobalKlothoTag
  scope: resource
  target: aws:ecs_cluster:stackpacks-ecs-cluster
  value: ''
- operator: equals
  property: Tags.ResourceName
  scope: resource
  target: aws:ecs_cluster:stackpacks-ecs-cluster
  value: stackpacks-ecs-cluster
- operator: equals
  property: Id
  scope: resource
  target: aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider
  value: stackpacks-ecs-cluster-5aff420
- operator: equals
  property: Name
  scope: resource
  target: aws:region:default_5_43_0
  value: eu-central-1
- operator: equals
  property: Arn
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-1
  value: arn:aws:ec2:eu-central-1:064389020595:subnet/subnet-0fe86baba5af579c4
- operator: equals
  property: CidrBlock
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-1
  value: 10.0.128.0/18
- operator: equals
  property: Id
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-1
  value: subnet-0fe86baba5af579c4
- operator: equals
  property: MapPublicIpOnLaunch
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-1
  value: false
- operator: equals
  property: Tags.GlobalKlothoTag
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-1
  value: ''
- operator: equals
  property: Tags.ResourceName
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-1
  value: stackpacks-private-subnet-1
- operator: equals
  property: Type
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-1
  value: private
- operator: equals
  property: Vpc
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-1
  value: aws:vpc:stackpacks-vpc
- operator: equals
  property: AvailabilityZone
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-1
  value: aws:availability_zone:region:az1
- operator: equals
  property: Arn
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-2
  value: arn:aws:ec2:eu-central-1:064389020595:subnet/subnet-0a7a05edcbdb1da55
- operator: equals
  property: CidrBlock
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-2
  value: 10.0.192.0/18
- operator: equals
  property: Id
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-2
  value: subnet-0a7a05edcbdb1da55
- operator: equals
  property: MapPublicIpOnLaunch
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-2
  value: false
- operator: equals
  property: Tags.GlobalKlothoTag
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-2
  value: ''
- operator: equals
  property: Tags.ResourceName
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-2
  value: stackpacks-private-subnet-2
- operator: equals
  property: Type
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-2
  value: private
- operator: equals
  property: Vpc
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-2
  value: aws:vpc:stackpacks-vpc
- operator: equals
  property: AvailabilityZone
  scope: resource
  target: aws:subnet:stackpacks-private-subnet-2
  value: aws:availability_zone:region:az2
- operator: equals
  property: Arn
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-1
  value: arn:aws:ec2:eu-central-1:064389020595:subnet/subnet-0cfff6507ebb63ecb
- operator: equals
  property: CidrBlock
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-1
  value: 10.0.0.0/18
- operator: equals
  property: Id
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-1
  value: subnet-0cfff6507ebb63ecb
- operator: equals
  property: MapPublicIpOnLaunch
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-1
  value: false
- operator: equals
  property: Tags.GlobalKlothoTag
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-1
  value: ''
- operator: equals
  property: Tags.ResourceName
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-1
  value: stackpacks-public-subnet-1
- operator: equals
  property: Type
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-1
  value: public
- operator: equals
  property: Vpc
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-1
  value: aws:vpc:stackpacks-vpc
- operator: equals
  property: AvailabilityZone
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-1
  value: aws:availability_zone:region:az1
- operator: equals
  property: Arn
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-2
  value: arn:aws:ec2:eu-central-1:064389020595:subnet/subnet-0fcb9d0ce4e84d35a
- operator: equals
  property: CidrBlock
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-2
  value: 10.0.64.0/18
- operator: equals
  property: Id
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-2
  value: subnet-0fcb9d0ce4e84d35a
- operator: equals
  property: MapPublicIpOnLaunch
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-2
  value: false
- operator: equals
  property: Tags.GlobalKlothoTag
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-2
  value: ''
- operator: equals
  property: Tags.ResourceName
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-2
  value: stackpacks-public-subnet-2
- operator: equals
  property: Type
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-2
  value: public
- operator: equals
  property: Vpc
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-2
  value: aws:vpc:stackpacks-vpc
- operator: equals
  property: AvailabilityZone
  scope: resource
  target: aws:subnet:stackpacks-public-subnet-2
  value: aws:availability_zone:region:az2
- operator: equals
  property: Arn
  scope: resource
  target: aws:vpc:stackpacks-vpc
  value: arn:aws:ec2:eu-central-1:064389020595:vpc/vpc-018204460500eff34
- operator: equals
  property: CidrBlock
  scope: resource
  target: aws:vpc:stackpacks-vpc
  value: 10.0.0.0/16
- operator: equals
  property: EnableDnsHostnames
  scope: resource
  target: aws:vpc:stackpacks-vpc
  value: true
- operator: equals
  property: EnableDnsSupport
  scope: resource
  target: aws:vpc:stackpacks-vpc
  value: true
- operator: equals
  property: Id
  scope: resource
  target: aws:vpc:stackpacks-vpc
  value: vpc-018204460500eff34
- operator: equals
  property: Tags.GlobalKlothoTag
  scope: resource
  target: aws:vpc:stackpacks-vpc
  value: ''
- operator: equals
  property: Tags.ResourceName
  scope: resource
  target: aws:vpc:stackpacks-vpc
  value: stackpacks-vpc
- operator: equals
  property: Region
  scope: resource
  target: aws:availability_zone:region:az1
  value: aws:region:region
- operator: equals
  property: Index
  scope: resource
  target: aws:availability_zone:region:az1
  value: 0
- operator: equals
  property: Region
  scope: resource
  target: aws:availability_zone:region:az2
  value: aws:region:region
- operator: equals
  property: Index
  scope: resource
  target: aws:availability_zone:region:az2
  value: 1
- operator: must_exist
  scope: edge
  target:
    source: aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider
    target: aws:ecs_cluster:stackpacks-ecs-cluster
- operator: must_exist
  scope: edge
  target:
    source: aws:ecs_capacity_provider:stackpacks-capacity-provider
    target: aws:ecs_cluster_capacity_provider:stackpacks-cluster-capacity-provider