Closed ghost closed 1 year ago
@andys-github Thanks for taking the time to bring this up. Can you provide the configuration you're using? It's possible that the modules are failing to perform the update.
There's at least one Terraform AWS Provider acceptance test (TestAccAWSBeanstalkEnv_settings_update
) that verifies updates to Elastic Beanstalk environment takes effect:
Initially:
resource "aws_elastic_beanstalk_environment" "test" {
application = aws_elastic_beanstalk_application.test.name
name = "yakstalk"
solution_stack_name = data.aws_elastic_beanstalk_solution_stack.test.name
setting {
namespace = "aws:ec2:vpc"
name = "VPCId"
value = aws_vpc.test.id
}
setting {
namespace = "aws:ec2:vpc"
name = "Subnets"
value = aws_subnet.test.id
}
setting {
namespace = "aws:ec2:vpc"
name = "AssociatePublicIpAddress"
value = "true"
}
setting {
namespace = "aws:autoscaling:launchconfiguration"
name = "SecurityGroups"
value = aws_security_group.test.id
}
setting {
namespace = "aws:autoscaling:launchconfiguration"
name = "IamInstanceProfile"
value = aws_iam_instance_profile.test.name
}
setting {
namespace = "aws:elasticbeanstalk:environment"
name = "ServiceRole"
value = aws_iam_role.service_role.name
}
}
Update:
resource "aws_elastic_beanstalk_environment" "test" {
application = aws_elastic_beanstalk_application.test.name
name = "yakstalk"
solution_stack_name = data.aws_elastic_beanstalk_solution_stack.test.name
setting {
namespace = "aws:ec2:vpc"
name = "VPCId"
value = aws_vpc.test.id
}
setting {
namespace = "aws:ec2:vpc"
name = "Subnets"
value = aws_subnet.test.id
}
setting {
namespace = "aws:ec2:vpc"
name = "AssociatePublicIpAddress"
value = "true"
}
setting {
namespace = "aws:autoscaling:launchconfiguration"
name = "SecurityGroups"
value = aws_security_group.test.id
}
setting {
namespace = "aws:autoscaling:launchconfiguration"
name = "IamInstanceProfile"
value = aws_iam_instance_profile.test.name
}
setting {
namespace = "aws:elasticbeanstalk:environment"
name = "ServiceRole"
value = aws_iam_role.service_role.name
}
setting {
namespace = "aws:elasticbeanstalk:application:environment"
name = "ENV_STATIC"
value = "true"
}
setting {
namespace = "aws:elasticbeanstalk:application:environment"
name = "ENV_UPDATE"
value = "true"
}
setting {
namespace = "aws:elasticbeanstalk:application:environment"
name = "ENV_REMOVE"
value = "true"
}
setting {
namespace = "aws:autoscaling:scheduledaction"
resource = "ScheduledAction01"
name = "MinSize"
value = 2
}
setting {
namespace = "aws:autoscaling:scheduledaction"
resource = "ScheduledAction01"
name = "MaxSize"
value = 3
}
setting {
namespace = "aws:autoscaling:scheduledaction"
resource = "ScheduledAction01"
name = "StartTime"
value = "2016-07-28T04:07:02Z"
}
}
@YakDriver thanks for looking into it. Here are the details that might help you:
main.tf
terraform {
required_version = ">= 0.12.0"
backend "http" {
}
}
provider "aws" {
region = "some-region"
}
elasticbeanstalk.tf
resource "aws_elastic_beanstalk_application" "eb_app" {
name = "app-name"
description = "My ElasticBeanstalk Application"
}
module "eb_tst" {
source = "path/to/module.zip"
### ---- some module variables ---- ###
# . . .
# . . .
# . . .
eb_app_name = aws_elastic_beanstalk_application.eb_app.name
eb_app_description = aws_elastic_beanstalk_application.eb_app.description
eb_environment = "TST"
solution_stack_name = "64bit Windows Server 2019 v2.6.4 running IIS 10.0"
ec2_instance_type = "t2.small"
asg_min_size = "1"
asg_max_size = "2"
# . . .
# . . .
# . . .
}
redacted code from module.tf
resource "aws_elastic_beanstalk_configuration_template" "eb_config" {
name = "${var.eb_app_name}-${var.eb_environment}-EB-CONFIG-${random_id.id.hex}"
application = var.eb_app_name
solution_stack_name = var.solution_stack_name
description = "${var.eb_app_name}-${var.eb_environment} ElasticBeanstalk Environment Template"
setting {
namespace = "aws:autoscaling:launchconfiguration"
name = "IamInstanceProfile"
value = aws_iam_instance_profile.instance_profile.name
}
setting {
namespace = "aws:autoscaling:launchconfiguration"
name = "InstanceType"
value = var.ec2_instance_type
}
setting {
namespace = "aws:autoscaling:launchconfiguration"
name = "SecurityGroups"
value = aws_security_group.security_group_instance.id
}
setting {
namespace = "aws:autoscaling:asg"
name = "MinSize"
value = var.asg_min_size
}
setting {
namespace = "aws:autoscaling:asg"
name = "MaxSize"
value = var.asg_max_size
}
# . . .
# . . .
# . . .
}
You might have noticed the backend is "http". It is so because we are using gitlab-terraform for building up our infrastructures. Let me know if you need anything else.
Hi team, please let me know if there's anything else expected from my end.
Here's the log from terraform apply : Releasing state lock. This may take a few moments... Apply complete! Resources: 0 added, 3 changed, 0 destroyed. Saving cache for successful job
Even though it says 3 changed, when I checked via aws console nothing had been updated.
@YakDriver : any updates??
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.
If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
This issue was originally opened by @andys-github as hashicorp/terraform#28356. It was migrated here as a result of the provider split. The original body of the issue is below.
This might be related to this issue
I was trying to adjust the minimum and maximum capacity for an ElasticBeanstalk environment. The terraform plan below shows that it would change the capacity:
But when I tried to verify it from the ElasticBeanstalk Configuration dashboard, I saw:
Please note, I tried updating the platform version of the environment just to be sure if it is only the min & max size that has an issue. But no, even the platform version doesn't get updated.
Also, not sure if it would be of any use, but I am using terraform modules to create/update the environment.