Skip to content
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

Accept variables in lifecycle attributes #22546

Closed
gtirloni opened this issue Aug 21, 2019 · 2 comments
Closed

Accept variables in lifecycle attributes #22546

gtirloni opened this issue Aug 21, 2019 · 2 comments

Comments

@gtirloni
Copy link

Use-cases

The end goal is to allow us to programmatically override a list of attributes that should be ignored.

For instance, an AutoScaling Group is defined with a Launch Configuration that ignores changes to the image_id attribute. Later, during a proper maintenance window, we want to tell the aws_launch_configuration resource that the ignore_changes list should be empty (so it picks up the image_id change).

Attempted Solutions

variable "ignore_ami_changes" {
  description = "If AMI changes should be ignored"
  type        = bool
  default     = true
}

resource "aws_launch_configuration" "default" {
  lifecycle {
     ignore_changes = var.ignore_ami_changes ? [image_id] : []
  }
}

The error:

Error: Invalid expression
on main.tf line 14, in resource "aws_launch_configuration" "default":
14:     ignore_changes = local.ignore_ami_changes
A static list expression is required.

Proposal

Allow lifecycle attributes to accept variables (interpolation)

References

@teamterraform
Copy link
Contributor

Hi @gtirloni!

As you saw, this use-case is already covered by #3116, so we're going to close this one. As noted in the other one, it was locked because all of the required information about the problem to be solved has already been gathered and so no further discussion is necessary.

@ghost
Copy link

ghost commented Sep 21, 2019

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.

@ghost ghost locked and limited conversation to collaborators Sep 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants