Forum Discussion
Using Terraform to update / modify an existing iRule
I could be missing something obvious here. I am attempting to use terraform to update an existing iRule (code below). Every time I run 'apply' I get an error saying: "
The requested iRule (/Common/Load_MWservices) already exists in partition Common"
I am wondering what the option would be to update an existing rule? It seems I can only create new ones? Thanks in advance
variable f5_hostname {}
variable f5_username {}
variable f5_password {}
terraform {
required_providers {
bigip = {
source = "F5Networks/bigip"
}
}
}
provider "bigip" {
address = var.f5_hostname
username = var.f5_username
password = var.f5_password
}
# Loading from a file is the preferred method
resource "bigip_ltm_irule" "rule" {
name = "/Common/Load_MWservices"
irule = file("Load_MWservices")
}
2 Replies
- fpettiford1991
Nimbostratus
Hey I was able to accomplish this and it was pretty simple.
Step 1. Create a Resource block for the existing iRuleresource "bigip_ltm_irule" "my_irule" {
name = "/Common/existing-irule-name"
irule = "" # Leave empty initially
}
Step 2. RUn the import commandterraform import bigip_ltm_irule.my_irule /Common/existing-irule-name
Step 3. Grab the irule contentsterraform state show bigip_ltm_irule.my_irule
From here you can paste this irule into the irule block that we left empty above..Im keeping all my iRule files seperated.
Hope this helps someone. You can't modify existing iRule. Delete and recreate iRule is only options.
irule = file("Load_MWservices")
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com