Skip to content

Commit

Permalink
Fix AMI mapping when empty disks (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
obierlaire committed Oct 2, 2023
1 parent 0612513 commit 20e3e2c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
2 changes: 0 additions & 2 deletions internal/plan/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package plan

import (
"embed"
"fmt"
"io/fs"
"path/filepath"

Expand Down Expand Up @@ -44,7 +43,6 @@ func loadMappings() error {
for _, file := range files {
// Check if it's a directory
if file.IsDir() {
fmt.Println(file.Name())
// Get the relative path
relativePath := filepath.Join(mappingsPath, file.Name())

Expand Down
4 changes: 2 additions & 2 deletions internal/plan/mappings/aws/ec2_asg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ compute_resource:
storage:
- type: list
item:
- paths: '${ami}.values.block_device_mappings[] | select(length > 0)'
- paths: '${ami}.values.block_device_mappings[] | select(.ebs | length > 0)'
properties:
size:
- paths: ".ebs.volume_size"
Expand Down Expand Up @@ -102,7 +102,7 @@ compute_resource:
override_priority:
- default: 0
- paths:
- '${launch_configuration}.values.block_device_mappings[] | select(length > 0) | select(.virtual_name == null or (.virtual_name | startswith("ephemeral") | not)) | select(.ebs != null)'
- '${launch_configuration}.values.block_device_mappings[] | select(.ebs | length > 0) | select(.virtual_name == null or (.virtual_name | startswith("ephemeral") | not)) | select(.ebs != null)'
properties:
size:
- paths:
Expand Down
4 changes: 2 additions & 2 deletions internal/plan/mappings/aws/ec2_instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ compute_resource:
- type: list
item:
- paths:
- '${ami}.values.block_device_mappings[] | select(length > 0)'
- '${ami}.values.block_device_mappings[] | select(.ebs | length > 0)'
properties:
size:
- paths: ".ebs.volume_size"
Expand Down Expand Up @@ -105,7 +105,7 @@ compute_resource:
override_priority:
- default : 0
- paths:
- '${launch_template}.values.block_device_mappings[] | select(length > 0) | select(.virtual_name == null or .virtual_name == "" or (.virtual_name | startswith("ephemeral") | not)) | select(.ebs != null)'
- '${launch_template}.values.block_device_mappings[] | select(.ebs | length > 0) | select(.virtual_name == null or .virtual_name == "" or (.virtual_name | startswith("ephemeral") | not)) | select(.ebs != null)'
properties:
size:
- paths:
Expand Down
19 changes: 16 additions & 3 deletions internal/plan/mappings/aws/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,20 @@ general:
json_data:
aws_instances : "aws_instances.json"
ignored_resources:
- "aws_vpc"
- "aws_volume_attachment"
- "aws_acm_certificate"
- "aws_alb_target_group_attachment"
- "aws_alb_target_group"
- "aws_alb_listener"
- "aws_autoscaling_attachment"
- "aws_iam_policy"
- "aws_iam_role_policy_attachment"
- "aws_iam_role"
- "aws_key_pair"
- "aws_launch_configuration"
- "aws_launch_template"
- "aws_launch_template"
- "aws_route_table_association"
- "aws_route_table"
- "aws_route53_record"
- "aws_security_group"
- "aws_volume_attachment"
- "aws_vpc"

0 comments on commit 20e3e2c

Please sign in to comment.