Skip to content

Commit 66037b2

Browse files
committed
Add Support for -refresh-only Option on Plan and Apply Actions
1 parent 514f4f0 commit 66037b2

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

lib/ruby_terraform/commands/apply.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ module Commands
4747
# * +:refresh+: when +true+, updates state prior to checking for
4848
# differences; when +false+ uses locally available state; defaults to
4949
# +true+; this has no effect when +:plan+ is provided.
50+
# * +:refresh_only+: when +true+, checks whether remote objects still
51+
# match the outcome of the most recent Terraform apply but does not
52+
# propose any actions to undo any changes made outside of Terraform; this
53+
# has no effect when +:plan+ is provided
5054
# * +:replace+: force replacement of a particular resource instance using
5155
# its resource address. If the apply would've normally produced an update
5256
# or no-op action for this instance, Terraform will replace it instead.
@@ -105,6 +109,7 @@ def options
105109
-no-color
106110
-parallelism
107111
-refresh
112+
-refresh-only
108113
-replace
109114
-state
110115
-state-out

lib/ruby_terraform/commands/plan.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ module Commands
4545
# * +:refresh+: when +true+, updates state prior to checking for
4646
# differences; when +false+ uses locally available state; defaults to
4747
# +true+; this has no effect when +:plan+ is provided.
48+
# * +:refresh_only+: when +true+, checks whether remote objects still
49+
# match the outcome of the most recent Terraform apply but does not
50+
# propose any actions to undo any changes made outside of Terraform
4851
# * +:replace+: force replacement of a particular resource instance using
4952
# its resource address. If the plan would've normally produced an update
5053
# or no-op action for this instance, Terraform will plan to replace it
@@ -100,6 +103,7 @@ def options
100103
-out
101104
-parallelism
102105
-refresh
106+
-refresh-only
103107
-replace
104108
-state
105109
-target

lib/ruby_terraform/options/definitions.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ module Options
3939
-list
4040
-lock
4141
-refresh
42+
-refresh-only
4243
-upgrade
4344
-verify-plugins
4445
-write

spec/ruby_terraform/commands/apply_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@
9090
described_class, 'apply', :refresh
9191
)
9292

93+
it_behaves_like(
94+
'a command with a boolean option',
95+
described_class, 'apply', :refresh_only
96+
)
97+
9398
it_behaves_like(
9499
'a command with an option',
95100
described_class, 'apply', :state

spec/ruby_terraform/commands/plan_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@
169169
described_class, 'plan', :refresh
170170
)
171171

172+
it_behaves_like(
173+
'a command with a boolean option',
174+
described_class, 'plan', :refresh_only
175+
)
176+
172177
it_behaves_like(
173178
'a command with an option',
174179
described_class, 'plan', :state

0 commit comments

Comments
 (0)