add failing test for resource type mismatch

This commit is contained in:
Katy Moe 2021-11-15 10:42:08 +00:00
parent 4305271cff
commit dc3ed6271c
No known key found for this signature in database
GPG Key ID: 8C3780F6DCDDA885
2 changed files with 21 additions and 0 deletions

View File

@ -386,6 +386,24 @@ Each resource can have moved from only one source resource.`,
},
WantError: ``, // This is okay because the call itself is not considered to be inside the package it refers to
},
"resource type mismatch": {
Statements: []MoveStatement{
makeTestMoveStmt(t, ``,
`test.nonexist1`,
`other.single`,
),
},
WantError: `Resource type mismatch: This statement declares a move from test.nonexist1 to other.single, which is a resource of a different type.`,
},
"resource instance type mismatch": {
Statements: []MoveStatement{
makeTestMoveStmt(t, ``,
`test.nonexist1[0]`,
`other.single`,
),
},
WantError: `Resource type mismatch: This statement declares a move from test.nonexist1[0] to other.single, which is a resource instance of a different type.`,
},
}
for name, test := range tests {

View File

@ -41,6 +41,9 @@ resource "test" "for_each" {
}
}
resource "other" "single" {
}
module "fake_external" {
# Our configuration fixture loader has a special case for a module call
# named "fake_external" where it will mutate the source address after