Skip to content

Commit 715a307

Browse files
committed
add check for merging
1 parent 859e3fe commit 715a307

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

aws2tf.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,22 @@ def main():
332332
else: common.empty_and_delete_bucket()
333333

334334

335+
# does a terraform.tfstate file exist in globals.path1 directory ?
336+
if not os.path.isfile(globals.path1+"/terraform.tfstate") and globals.merge:
337+
print("No terraform.tfstate file found in "+globals.path1+" - cannot merge")
338+
globals.merge=False
339+
com = "rm -rf "+globals.path1
340+
rout = common.rc(com)
341+
if globals.serverless: common.empty_and_delete_bucket()
342+
343+
335344
if globals.merge is False:
336345
com = "rm -rf "+globals.path1
337346
rout = common.rc(com)
338347
if globals.serverless: common.empty_and_delete_bucket()
339348

340349

350+
341351
com = "mkdir -p "+globals.path2
342352
rout = common.rc(com)
343353

0 commit comments

Comments
 (0)