-
-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module recreates all settings
on each terraform plan/apply
#43
Comments
Excellent write up |
terraform-aws-elastic-beanstalk-environment
recreates all settings
on each terraform plan/apply
settings
on each terraform plan/apply
As a minimum would be possible to at least not print the key/value pairs which are unchanged? It would significantly reduce the amount of noise and make it easier to understand if there is anything really different in the "settings".
Is there a reason Terraform prints these unchanged settings? |
No, the plan output is determined by terraform and cannot be silenced. We have no control over it. Needs to be fixed in the provider. |
So I guess what I am asking for would be a Terraform feature, right? (I am completely new to Terraform , just started using yesterday). |
@tigrannajaryan |
Some of the settings used here do not apply to every Beanstalk setup. E.g. when using an ALB (and not the classic ones) all Besides that, Beanstalk/AWS sometimes accepts slightly different values when it comes to whitespaces. In this module, this setting will cause a reset of all settings, because of "wrong" whitespacing:
This will fix it (in this case):
What I just did, was to remove every setting which is not applicable for a v2-loadbalancer and checking every setting on whitespace-"errors". Voila: no changes anymore. I hope that the beanstalk setting will become an own resource, that should fix some other flaws with it. Knowing that whitespace-thingy and the reapplication of mismatched settings fixed it for me. @aknysh : can it be that you created a EBS setup with a classic loadbalancer? This would be same case I described but vice versa. If you add a v1-ELB, all the v2-settings are reapplied every time. |
Oh, another thing... seems to be a bug in terraform to me: settings with lists may be sent unsorted to the AWS API:
Just sort the input:
|
For the module, it would make sense to apply the settings as a map from the outside. With this, we could eliminate those settings which are not applicable for the setup (e.g. passing As soon as I have time, I'll try this out and create a PR for this for further discussion. |
@DrFunk-n-stein thanks! |
narf. We have to wait for 0.12.: |
I was making my mind about this, maybe we can do a workaround and create several resources of an environment equipped with count. Those could be dependant on the type of load balancer - this way we could handle separate configurations. Downside: it's bloats up the module and there might be a fix for the list-of-maps-issue in 0.12 |
This is something that I have been meaning to try for a while, which won't solve the problem at all but might at the least make it easier to read https://github.com/coinbase/terraform-landscape |
it looks like some of these problems can be solved by using an app template. https://www.terraform.io/docs/providers/aws/r/elastic_beanstalk_configuration_template.html. worked for me. |
@adjavaherian - thanks a bunch for your tip about the configuration template! It did the trick for me as well. There's one problem with this approach though. Updating the elastic_beanstalk_configuration_template will not cause the elastic_beanstalk_environment to update. |
The next time I update the
|
this is a known bug and we are kind of stuck on this. planning to write custom comparison |
I was playing with a custom diff in the resource, but I could not detect an abnormal comparison of settings using the test |
@aknysh You had mentioned at the beginning that we could hackishly override the changes:
I am interested in adding that option but I get an error "The block type name "lifecycle" is reserved for use by Terraform in a future version." Did you get that working, and if so, where did you make the code change? EditNever mind, I see that this is a terraform 0.12.x issue; they removed the ability to set |
Would be nice to have a fix/workaround here as seeing the changes is quite annoying. Seems that you can't configure |
This is still not fixed completely. I've added a comment on the merged fix that still has potential for the problem. |
@helvalius @maximmi - This is still happening on v0.22 |
Yea the fix from @informeto helps and there is a new issue with the parallel merge of the SpotOn support, for me those variables are still having the issue. I'll see to update that in my pull request or someone else could do a fix for those. |
I just wanted to link to this issue: hashicorp/terraform-provider-aws#1471 ...as it seems to be where there is some relatively recent discussion regarding the Terraform provider. There is also a workaround that is quite effective: Just add |
For me, switching to AWS provider v3 solved the problem of reapplication of settings. I was earlier on 2.70.0 and once I switched to 3.22.0, this issue was gone. |
Using aws provider with version 3.22 and terraform 0.14.7 and still having the issue using a Classic load balancer only: # module.elastic_beanstalk_environment.aws_elastic_beanstalk_environment.default will be updated in-place
~ resource "aws_elastic_beanstalk_environment" "default" {
id = "e-vzua8aifyy"
name = "envir"
tags = {
"Environment" = "envir"
}
# (16 unchanged attributes hidden)
+ setting {
+ name = "HealthCheckPath"
+ namespace = "aws:elasticbeanstalk:environment:process:default"
+ value = "/"
}
+ setting {
+ name = "InstancePort"
+ namespace = "aws:elb:listener"
+ value = "80"
}
+ setting {
+ name = "ListenerEnabled"
+ namespace = "aws:elb:listener"
+ value = "true"
}
+ setting {
+ name = "ListenerProtocol"
+ namespace = "aws:elb:listener"
+ value = "HTTP"
}
+ setting {
+ name = "Port"
+ namespace = "aws:elasticbeanstalk:environment:process:default"
+ value = "80"
}
+ setting {
+ name = "Protocol"
+ namespace = "aws:elasticbeanstalk:environment:process:default"
+ value = "HTTP"
}
# (62 unchanged blocks hidden)
} My configs are default for these params. |
Is this issue still not resolved? it's been two years since last @florian0410 post and I have the same problem. I'm using classic loadbalancer. My Terraform version is 1.1.9 with aws v4.58.0 provider. Module version v0.49.0 |
terraform-aws-elastic-beanstalk-environment
recreates allsettings
on eachterraform plan/apply
This feature/bug was present for years and is still not fixed:
hashicorp/terraform#6729
hashicorp/terraform-provider-aws#901
hashicorp/terraform#6257
hashicorp/terraform-provider-aws#280
hashicorp/terraform#11056
hashicorp/terraform-provider-aws#461
(tested some ideas from the links above, nothing worked 100%)
The only possible solution is to add this:
but it’s a hack since it will not update the env if you update any of the settings.
Regarding
terraform-aws-elastic-beanstalk-environment
recreating thesettings
all the time, here what’s probably happening:advanced
algorithm to determine if they are the same)What’s a possible solution?
Introduce
var.settings
(list of maps) to be able to provide all the required settings from outside of the module.It might work, but in practice would be very difficult to know all the needed settings and tedious to implement.
The text was updated successfully, but these errors were encountered: