@@ -21,6 +21,80 @@ def test_remove_unchanged_attributes():
2121
2222 assert remove_unchanged_attributes (plan ) == expected
2323
24+
25+ def test_remove_warnings_with_import ():
26+ plan = '''
27+ Terraform used the selected providers to generate the following execution
28+ plan. Resource actions are indicated with the following symbols:
29+ + create
30+
31+ Terraform will perform the following actions:
32+
33+ # random_string.count[0] will be created
34+ + resource "random_string" "count" {
35+ + id = (known after apply)
36+ + length = 5
37+ + lower = true
38+ + min_lower = 0
39+ + min_numeric = 0
40+ + min_special = 0
41+ + min_upper = 0
42+ + number = true
43+ + numeric = true
44+ + result = (known after apply)
45+ + special = false
46+ + upper = true
47+ }
48+
49+ Plan: 26 to import, 1 to add, 0 to change, 0 to destroy.
50+
51+ Changes to Outputs:
52+ + count = (known after apply)
53+
54+ Warning: Resource targeting is in effect
55+
56+ You are creating a plan with the -target option, which means that the result
57+ of this plan may not represent all of the changes requested by the current
58+ configuration.
59+
60+ The -target option is not for routine use, and is provided only for
61+ exceptional situations such as recovering from errors or mistakes, or when
62+ Terraform specifically suggests to use it as part of an error message.
63+ '''
64+
65+ expected = '''
66+ Terraform used the selected providers to generate the following execution
67+ plan. Resource actions are indicated with the following symbols:
68+ + create
69+
70+ Terraform will perform the following actions:
71+
72+ # random_string.count[0] will be created
73+ + resource "random_string" "count" {
74+ + id = (known after apply)
75+ + length = 5
76+ + lower = true
77+ + min_lower = 0
78+ + min_numeric = 0
79+ + min_special = 0
80+ + min_upper = 0
81+ + number = true
82+ + numeric = true
83+ + result = (known after apply)
84+ + special = false
85+ + upper = true
86+ }
87+
88+ Plan: 26 to import, 1 to add, 0 to change, 0 to destroy.
89+
90+ Changes to Outputs:
91+ + count = (known after apply)
92+
93+ '''
94+
95+ assert remove_warnings (plan ).strip () == expected .strip ()
96+
97+
2498def test_remove_warnings ():
2599 plan = '''
26100Terraform used the selected providers to generate the following execution
0 commit comments