-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
No way to pass a null value for aws_autoscaling_group.availability_zones
#1187
Comments
Hey @joshuaspence Thanks for reporting the issue. This looks more a Core bug to me, especially since it would mean treating @apparentlymart Could we have your point of view there? Thanks :) |
I think this demonstrates a limitation of what Mitchell suggested in that other issue. In most cases it is equivalent to either leave a value unset or to set it to some "empty value", there is one situation where this isn't true: situations where an argument is optional and the API provides some sort of default when it isn't set. (Internally, this is represented as The trick here is that Terraform uses the absense of the argument as "use what the server says", not the "zero-ness" of it. So by explicitly setting it to So unfortunately things are working as designed here, though I understand that it's frustrating in this case. We're in the early stages of discussing improvements to the configuration language we can make over the next few major versions of Terraform and the ability to explicitly "null out" attributes is on the list, so I think this will get addressed one way or another without the need for an explicit issue for it in the core repo. |
I have a `lambda_function` module, which supports both EC2 classic and VPC. The problem I have, however, is that there is no way to specify a null configuration for `vpc_config`. This pull request changes the behavior so that the following Terraform configuration is //ignored//, instead of failing with an error (the current behavior): ``` resource "aws_lambda_function" "test" { # ... vpc_config { security_group_ids = [] subnet_ids = [] } } ``` See also hashicorp#1187 and hashicorp#1190.
I have a `lambda_function` module, which supports both EC2 classic and VPC. The problem I have, however, is that there is no way to specify a null configuration for `vpc_config`. This pull request changes the behavior so that the following Terraform configuration is //ignored//, instead of failing with an error (the current behavior): ``` resource "aws_lambda_function" "test" { # ... vpc_config { security_group_ids = [] subnet_ids = [] } } ``` See also hashicorp#1187 and hashicorp#1190.
I have a `lambda_function` module, which supports both EC2 classic and VPC. The problem I have, however, is that there is no way to specify a null configuration for `vpc_config`. This pull request changes the behavior so that the following Terraform configuration is //ignored//, instead of failing with an error (the current behavior): ``` resource "aws_lambda_function" "test" { # ... vpc_config { security_group_ids = [] subnet_ids = [] } } ``` See also hashicorp#1187 and hashicorp#1190.
I have a `lambda_function` module, which supports both EC2 classic and VPC. The problem I have, however, is that there is no way to specify a null configuration for `vpc_config`. This pull request changes the behavior so that the following Terraform configuration is //ignored//, instead of failing with an error (the current behavior): ``` resource "aws_lambda_function" "test" { # ... vpc_config { security_group_ids = [] subnet_ids = [] } } ``` See also hashicorp#1187 and hashicorp#1190.
I have a `lambda_function` module, which supports both EC2 classic and VPC. The problem I have, however, is that there is no way to specify a null configuration for `vpc_config`. This pull request changes the behavior so that the following Terraform configuration is //ignored//, instead of failing with an error (the current behavior): ``` resource "aws_lambda_function" "test" { # ... vpc_config { security_group_ids = [] subnet_ids = [] } } ``` See also hashicorp#1187 and hashicorp#1190.
I have a `lambda_function` module, which supports both EC2 classic and VPC. The problem I have, however, is that there is no way to specify a null configuration for `vpc_config`. This pull request changes the behavior so that the following Terraform configuration is //ignored//, instead of failing with an error (the current behavior): ``` resource "aws_lambda_function" "test" { # ... vpc_config { security_group_ids = [] subnet_ids = [] } } ``` See also hashicorp#1187 and hashicorp#1190.
I have a `lambda_function` module, which supports both EC2 classic and VPC. The problem I have, however, is that there is no way to specify a null configuration for `vpc_config`. This pull request changes the behavior so that the following Terraform configuration is //ignored//, instead of failing with an error (the current behavior): ``` resource "aws_lambda_function" "test" { # ... vpc_config { security_group_ids = [] subnet_ids = [] } } ``` See also hashicorp#1187 and hashicorp#1190.
I have a `lambda_function` module, which supports both EC2 classic and VPC. The problem I have, however, is that there is no way to specify a null configuration for `vpc_config`. This pull request changes the behavior so that the following Terraform configuration is //ignored//, instead of failing with an error (the current behavior): ``` resource "aws_lambda_function" "test" { # ... vpc_config { security_group_ids = [] subnet_ids = [] } } ``` See also hashicorp#1187 and hashicorp#1190.
I have a `lambda_function` module, which supports both EC2 classic and VPC. The problem I have, however, is that there is no way to specify a null configuration for `vpc_config`. This pull request changes the behavior so that the following Terraform configuration is //ignored//, instead of failing with an error (the current behavior): ``` resource "aws_lambda_function" "test" { # ... vpc_config { security_group_ids = [] subnet_ids = [] } } ``` See also hashicorp#1187 and hashicorp#1190.
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
In hashicorp/terraform#5471, @mitchellh said:
It seems that
aws_autoscaling_group.availability_zones
is an example of this issue. I have a module that I am using to create autoscaling groups both in EC2-Classic and VPC. It is basically a wrapper around theaws_autoscaling_group
andaws_launch_configuration
resources. In order to support both Classic and VPC, I need to expose anavailability_zones
variable. The problem is that there is no way to pass anull
value to this variable.I think that the best fix here is to treat
[]
(an empty list) as being equivalent tonull
. The reason that I suggest this is because[]
is not a valid value anyway. In EC2-Classic, attempting to passavailabilitity_zones = []
produces an error:In a VPC, passing
availability_zones = []
produces a perpetual set of changes (because the API seems to transparently replace[]
with the set of availability zones corresponding to the specified subnets):The text was updated successfully, but these errors were encountered: