Skip to content

Commit

Permalink
fix(ec2_prompt): resolve bugs related to varibales with object type
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadll committed Nov 20, 2024
1 parent 56deae8 commit 6d6ee02
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion app/template_generators/terraform/aws/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def IaC_template_generator_ec2(input) -> str:
}}
```
- Defines a module block that references "ec2" from a subdirectory within modules.
Don't forget to use source parameter to call ec2 module. this is so important.
Don't forget to use source parameter to call ec2 module as follows:
```
source = "./modules/ec2"
```
This module block should expose all variables that {ec2} resources require, allowing
configuration at the root level rather than directly within the module.
- Every variable defined in {ec2} resources should be passed through the module block,
Expand All @@ -33,6 +36,25 @@ def IaC_template_generator_ec2(input) -> str:
key_pair_create(bool), key_pair_name(string)
- Sets these variables names for aws_security_group resource:
security_group_create(bool), security_group_name(string), security_group_ingress_rules(map(object)), security_group_egress_rule(object())
Sets security_group_ingress_rules as follows:
```
type = map(object({{
description = string
from_port = number
to_port = number
protocol = string
cidr_blocks = list(string)
}}))
```
Sets security_group_egress_rule as follows:
```
type = object({{
from_port = number
to_port = number
protocol = string
cidr_blocks = list(string)
}})
```
- Sets these variables names for aws_instance resource:
instance_create(bool), instance_type(string)
- Sets these variables names for aws_ami_from_instance resource:
Expand Down Expand Up @@ -192,6 +214,25 @@ def IaC_template_generator_ec2(input) -> str:
key_pair_create(bool), key_pair_name(string)
- Sets these variables names for aws_security_group resource:
security_group_create(bool), security_group_name(string), security_group_ingress_rules(map(object)), security_group_egress_rule(object())
Sets security_group_ingress_rules as follows:
```
type = map(object({{
description = string
from_port = number
to_port = number
protocol = string
cidr_blocks = list(string)
}}))
```
Sets security_group_egress_rule as follows:
```
type = object({{
from_port = number
to_port = number
protocol = string
cidr_blocks = list(string)
}})
```
- Sets these variables names for aws_instance resource:
instance_create(bool), instance_type(string)
- Sets these variables names for aws_ami_from_instance resource:
Expand Down

0 comments on commit 6d6ee02

Please sign in to comment.