Difference between revisions of "Terraform lifecycle meta-argument"
Jump to navigation
Jump to search
(15 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
* https://www.terraform.io/language/meta-arguments/lifecycle | * https://www.terraform.io/language/meta-arguments/lifecycle | ||
+ | <code>[[create_before_destroy]] | [[prevent_destroy]] | [[ignore_changes]] | [[replace_triggered_by]]</code> | ||
+ | |||
+ | |||
+ | == Options == | ||
* <code>create_before_destroy</code> changes default behavior so that the new replacement object is created first, and the prior object is destroyed after the replacement is created. | * <code>create_before_destroy</code> changes default behavior so that the new replacement object is created first, and the prior object is destroyed after the replacement is created. | ||
− | * <code>prevent_destroy</code> | + | * <code>[[prevent_destroy]]</code> |
− | * <code>ignore_changes</code> | + | * <code>[[ignore_changes]]</code> |
− | * <code>replace_triggered_by</code> | + | * <code>[[replace_triggered_by]]</code> (May 2022, [[v1.2.0]]) |
== Examples == | == Examples == | ||
− | + | ||
− | resource "azurerm_resource_group" "example" { | + | resource "[[azurerm_resource_group]]" "example" { |
− | + | # ... | |
− | + | ||
− | + | [[lifecycle]] { | |
− | + | create_before_destroy = true | |
− | + | } | |
− | } | + | } |
− | + | ||
− | |||
− | |||
− | |||
lifecycle { | lifecycle { | ||
− | ignore_changes = [ | + | [[ignore_changes]] = [ |
latest_restorable_time | latest_restorable_time | ||
] | ] | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
== Related == | == Related == | ||
− | * [[meta-argument]] | + | * <code>[[meta-argument]]</code> |
+ | * [[Terraform EKS module eks_managed_node_groups: desired_size]] | ||
+ | * <code>[[terraform apply -target]]</code> | ||
== See also == | == See also == | ||
+ | * {{tf lifecycle}} | ||
* {{Terraform meta-arguments}} | * {{Terraform meta-arguments}} | ||
− | |||
[[Category:Terraform]] | [[Category:Terraform]] |
Latest revision as of 13:12, 16 August 2023
create_before_destroy | prevent_destroy | ignore_changes | replace_triggered_by
Contents
Options[edit]
create_before_destroy
changes default behavior so that the new replacement object is created first, and the prior object is destroyed after the replacement is created.prevent_destroy
ignore_changes
replace_triggered_by
(May 2022, v1.2.0)
Examples[edit]
resource "azurerm_resource_group" "example" { # ... lifecycle { create_before_destroy = true } } lifecycle { ignore_changes = [ latest_restorable_time ] }
Related[edit]
See also[edit]
Advertising: