From 19abda55348c37309604c715688eab1838575375 Mon Sep 17 00:00:00 2001 From: karajan1001 Date: Thu, 14 Oct 2021 15:21:05 +0800 Subject: [PATCH] Rebase to master --- tests/test_terraform.py | 6 ++---- tpi/terraform.py | 6 +----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/test_terraform.py b/tests/test_terraform.py index 9d8aea9..1879520 100644 --- a/tests/test_terraform.py +++ b/tests/test_terraform.py @@ -157,10 +157,8 @@ def test_state_mv(tmp_path, resource): mtype = "iterative_machine" tf = TerraformBackend(tmp_path) - tf.state_mv( - name=resource, source=f"{mtype}.{resource}", destination=f"{mtype}.{new_name}" - ) + tf.state_mv(source=f"{mtype}.{resource}", destination=f"{mtype}.{new_name}") - with open(tmp_path / resource / "terraform.tfstate") as fobj: + with open(tmp_path / "terraform.tfstate") as fobj: tfstate = json.load(fobj) assert tfstate["resources"][0]["name"] == new_name diff --git a/tpi/terraform.py b/tpi/terraform.py index 2bfab18..c2a64df 100644 --- a/tpi/terraform.py +++ b/tpi/terraform.py @@ -137,8 +137,4 @@ def state_mv(self, source, destination, **kwargs): different resource instance address. """ assert source and destination - - name = source.split(".")[-1] - - with self.make_tf(name) as tf: - tf.cmd("state mv", source, destination) + self.tf.cmd("state mv", source, destination)