Skip to content

Commit 0cdd527

Browse files
kcebmaximmiactions-bot
authored
feat: add support for ami_id (#109)
* feat: add support for ami_id * Updated README.md * Executed 'terraform fmt' * dynamic block used for AMI id setting * Updated README.md Co-authored-by: Maxim Mironenko <[email protected]> Co-authored-by: actions-bot <[email protected]>
1 parent b809467 commit 0cdd527

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ Available targets:
201201
| additional_settings | Additional Elastic Beanstalk setttings. For full list of options, see https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html | object | `<list>` | no |
202202
| alb_zone_id | ALB zone id | map(string) | `<map>` | no |
203203
| allowed_security_groups | List of security groups to add to the EC2 instances | list(string) | `<list>` | no |
204+
| ami_id | The id of the AMI to associate with the Amazon EC2 instances | string | `null` | no |
204205
| application_port | Port application is listening on | number | `80` | no |
205206
| application_subnets | List of subnets to place EC2 instances | list(string) | - | yes |
206207
| associate_public_ip_address | Whether to associate public IP addresses to the instances | bool | `false` | no |

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
| additional_settings | Additional Elastic Beanstalk setttings. For full list of options, see https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html | object | `<list>` | no |
77
| alb_zone_id | ALB zone id | map(string) | `<map>` | no |
88
| allowed_security_groups | List of security groups to add to the EC2 instances | list(string) | `<list>` | no |
9+
| ami_id | The id of the AMI to associate with the Amazon EC2 instances | string | `null` | no |
910
| application_port | Port application is listening on | number | `80` | no |
1011
| application_subnets | List of subnets to place EC2 instances | list(string) | - | yes |
1112
| associate_public_ip_address | Whether to associate public IP addresses to the instances | bool | `false` | no |

main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,15 @@ resource "aws_elastic_beanstalk_environment" "default" {
700700
resource = ""
701701
}
702702

703+
dynamic "setting" {
704+
for_each = var.ami_id == null ? [] : [var.ami_id]
705+
content {
706+
namespace = "aws:autoscaling:launchconfiguration"
707+
name = "ImageId"
708+
value = setting.value
709+
}
710+
}
711+
703712
setting {
704713
namespace = "aws:elasticbeanstalk:command"
705714
name = "BatchSizeType"

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,3 +454,9 @@ variable "alb_zone_id" {
454454

455455
description = "ALB zone id"
456456
}
457+
458+
variable "ami_id" {
459+
type = string
460+
default = null
461+
description = "The id of the AMI to associate with the Amazon EC2 instances"
462+
}

0 commit comments

Comments
 (0)