terraform-provider-bigip icon indicating copy to clipboard operation
terraform-provider-bigip copied to clipboard

Feature Request: Add capability to tolerate existing node

Open theseao opened this issue 6 years ago • 4 comments

Hello

Is it possible to add capability to the bigip_ltm_node resource to not error out (ignore) when encountering an existing node?

Thanks

theseao avatar Feb 04 '19 17:02 theseao

The general behavior in Terraform is that existing resource (created outside of Terraform) should be imported into the state, the error here is actually coming from F5 itself as the same resource you try to provision via Terraform already exists.

If you use terraform import, you can add that node to your state and terraform won't try to provision it again.

dannyk81 avatar Feb 04 '19 21:02 dannyk81

Hello. Understood on both counts.

The scenario we are attempting to address is: a new, single terraform apply of a complete environment with multiple virtual servers that each use the same node or nodes. When the loop for the second virtual server executes, the node is redundant, having been already created during the initial loop.

Upon receiving the “node exists” error from the F5, the code execution terminates. Ideally, we’d address this by using some if/then logic in the TF code that simply skips the node resource after the first loop, but to our knowledge this functionality isn’t yet available.

We have a workaround which simply references a source control branch with the node resource code omitted for creation of subsequent virtual servers. But that’s awkward, at best, and not very sustainable. Thus, our question whether it’s possible to add the capability for the terraform apply to continue despite the node exists error. (Or any other ideas how to address.)

Thank you

From: Danny Kulchinsky [email protected] Sent: Monday, February 04, 2019 1:24 PM To: terraform-providers/terraform-provider-bigip [email protected] Cc: Chris Olsen [email protected]; Author [email protected] Subject: Re: [terraform-providers/terraform-provider-bigip] Feature Request: Add capability to tolerate existing node (#53)

Please take care when opening links, attachments or responding to this email as it originated outside of PGE.

The general behavior in Terraform is that existing resource (created outside of Terraform) should be imported into the state, the error here is actually coming from F5 itself as the same resource you try to provision via Terraform already exists.

If you use terraform import, you can add that node to your state and terraform won't try to provision it again.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/terraform-providers/terraform-provider-bigip/issues/53#issuecomment-460418377, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AqvUfpKWziLcqSfNXSPcOgBTLE1_Qjzaks5vKKT8gaJpZM4ahtmp.

theseao avatar Feb 04 '19 22:02 theseao

It would be easier to understand if you can share your terraform configuration for the relevant bigip resources.

in general, this shouldn't happen - the nodes resource should be created once and later referenced in all the relevant pools (virtual servers don't reference nodes by the way)

On Mon, 4 Feb 2019 at 17:28, theseao [email protected] wrote:

Hello. Understood on both counts.

The scenario we are attempting to address is: a new, single terraform apply of a complete environment with multiple virtual servers that each use the same node or nodes. When the loop for the second virtual server executes, the node is redundant, having been already created during the initial loop.

Upon receiving the “node exists” error from the F5, the code execution terminates. Ideally, we’d address this by using some if/then logic in the TF code that simply skips the node resource after the first loop, but to our knowledge this functionality isn’t yet available.

We have a workaround which simply references a source control branch with the node resource code omitted for creation of subsequent virtual servers. But that’s awkward, at best, and not very sustainable. Thus, our question whether it’s possible to add the capability for the terraform apply to continue despite the node exists error. (Or any other ideas how to address.)

Thank you

From: Danny Kulchinsky [email protected] Sent: Monday, February 04, 2019 1:24 PM To: terraform-providers/terraform-provider-bigip < [email protected]> Cc: Chris Olsen [email protected]; Author [email protected] Subject: Re: [terraform-providers/terraform-provider-bigip] Feature Request: Add capability to tolerate existing node (#53)

Please take care when opening links, attachments or responding to this email as it originated outside of PGE.

The general behavior in Terraform is that existing resource (created outside of Terraform) should be imported into the state, the error here is actually coming from F5 itself as the same resource you try to provision via Terraform already exists.

If you use terraform import, you can add that node to your state and terraform won't try to provision it again.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/terraform-providers/terraform-provider-bigip/issues/53#issuecomment-460418377>, or mute the thread< https://github.com/notifications/unsubscribe-auth/AqvUfpKWziLcqSfNXSPcOgBTLE1_Qjzaks5vKKT8gaJpZM4ahtmp>.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/terraform-providers/terraform-provider-bigip/issues/53#issuecomment-460438747, or mute the thread https://github.com/notifications/unsubscribe-auth/AXJk7HYuoBSZIjK3ho9qW4ks6efB_XN_ks5vKLQRgaJpZM4ahtmp .

dannyk81 avatar Feb 04 '19 22:02 dannyk81

So, I'm running in to this issue as well. Basically, trying to setup a blue / green set of of environments so we can test changes on parallel configurations before cutovers. We've one set of Terraform code for blue and another set for green. Most of the resources have (blue|green) in their name to avoid duplication, but since we are using FQDN nodes those are named the same in both places and Terraform bails due to the existing resource from the other color. Is it possible for it to just go "oh, this resource exists and is exactly the same as what I want to create, so carry on"?

ddcrjlalumiere avatar Aug 31 '20 21:08 ddcrjlalumiere

Hi, closing this request now. Please re-open if required or send an email to [email protected]. Thanks!

KrithikaChidambaram avatar Feb 21 '23 11:02 KrithikaChidambaram