Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Terraform
Commits
e574f73f
Commit
e574f73f
authored
3 years ago
by
James Bardin
Browse files
Options
Download
Email Patches
Plain Diff
test with marked, unknown, planned values
parent
ea077cbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
internal/terraform/context_apply2_test.go
+56
-0
internal/terraform/context_apply2_test.go
with
56 additions
and
0 deletions
+56
-0
internal/terraform/context_apply2_test.go
+
56
-
0
View file @
e574f73f
...
...
@@ -508,3 +508,59 @@ output "out" {
}
}
}
func
TestContext2Apply_ignoreImpureFunctionChanges
(
t
*
testing
.
T
)
{
// Ensure we're not trying to double-mark values decoded from state
m
:=
testModuleInline
(
t
,
map
[
string
]
string
{
"main.tf"
:
`
variable "pw" {
sensitive = true
default = "foo"
}
resource "test_object" "x" {
test_map = {
string = "X${bcrypt(var.pw)}"
}
lifecycle {
ignore_changes = [ test_map["string"] ]
}
}
`
,
})
p
:=
simpleMockProvider
()
ctx
:=
testContext2
(
t
,
&
ContextOpts
{
Config
:
m
,
Providers
:
map
[
addrs
.
Provider
]
providers
.
Factory
{
addrs
.
NewDefaultProvider
(
"test"
)
:
testProviderFuncFixed
(
p
),
},
})
_
,
diags
:=
ctx
.
Plan
()
if
diags
.
HasErrors
()
{
t
.
Fatal
(
diags
.
ErrWithWarnings
())
}
_
,
diags
=
ctx
.
Apply
()
if
diags
.
HasErrors
()
{
t
.
Fatal
(
diags
.
ErrWithWarnings
())
}
// FINAL PLAN:
plan
,
diags
:=
ctx
.
Plan
()
if
diags
.
HasErrors
()
{
t
.
Fatal
(
diags
.
ErrWithWarnings
())
}
// make sure the same marks are compared in the next plan as well
for
_
,
c
:=
range
plan
.
Changes
.
Resources
{
if
c
.
Action
!=
plans
.
NoOp
{
t
.
Logf
(
"marks before: %#v"
,
c
.
BeforeValMarks
)
t
.
Logf
(
"marks after: %#v"
,
c
.
AfterValMarks
)
t
.
Errorf
(
"Unexpcetd %s change for %s"
,
c
.
Action
,
c
.
Addr
)
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help