mirror of https://github.com/hashicorp/terraform
stacks: check providers blocks in components during validatation (#34707)
parent
bced645a4d
commit
b3abff5750
@ -0,0 +1,26 @@
|
||||
required_providers {
|
||||
testing = {
|
||||
// The source is wrong, so validate should complain.
|
||||
source = "hashicorp/wrong"
|
||||
version = "0.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
provider "testing" "default" {}
|
||||
|
||||
variable "input" {
|
||||
type = string
|
||||
}
|
||||
|
||||
component "self" {
|
||||
source = "../"
|
||||
|
||||
providers = {
|
||||
// Everything looks okay here, but the provider types are actually wrong.
|
||||
testing = provider.testing.default
|
||||
}
|
||||
|
||||
inputs = {
|
||||
input = var.input
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
required_providers {
|
||||
testing = {
|
||||
source = "hashicorp/testing"
|
||||
version = "0.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
provider "testing" "default" {}
|
||||
|
||||
variable "input" {
|
||||
type = string
|
||||
}
|
||||
|
||||
component "self" {
|
||||
source = "../"
|
||||
|
||||
# We do actually require a provider here, Validate() should warn us.
|
||||
providers = {}
|
||||
|
||||
inputs = {
|
||||
input = var.input
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
required_providers {
|
||||
other = {
|
||||
source = "hashicorp/testing"
|
||||
version = "0.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
provider "other" "default" {}
|
||||
|
||||
variable "input" {
|
||||
type = string
|
||||
}
|
||||
|
||||
component "self" {
|
||||
source = "../"
|
||||
|
||||
providers = {
|
||||
// Even though the names are wrong, the underlying types are the same
|
||||
// so this should be okay.
|
||||
testing = provider.other.default
|
||||
}
|
||||
|
||||
inputs = {
|
||||
input = var.input
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
variable "input" {
|
||||
type = string
|
||||
}
|
||||
|
||||
component "self" {
|
||||
source = "../"
|
||||
|
||||
providers = {
|
||||
# We haven't provided a definition for this anywhere.
|
||||
testing = provider.testing.default
|
||||
}
|
||||
|
||||
inputs = {
|
||||
input = var.input
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue