command/013upgrade: detect builtin terraform provider (#25215)
* command/013upgrade: detect builtin terraform provider
This commit is contained in:
parent
9303b9f8fc
commit
5450e8515d
|
@ -240,6 +240,11 @@ command and dealing with them before running this command again.
|
|||
for _, file := range files {
|
||||
// Step 2: add missing provider requirements from provider blocks
|
||||
for _, p := range file.ProviderConfigs {
|
||||
// Skip internal providers
|
||||
if p.Name == "terraform" {
|
||||
continue
|
||||
}
|
||||
|
||||
// If no explicit provider configuration exists for the
|
||||
// provider configuration's local name, add one with a legacy
|
||||
// provider address.
|
||||
|
@ -266,6 +271,11 @@ command and dealing with them before running this command again.
|
|||
localName = r.Addr().ImpliedProvider()
|
||||
}
|
||||
|
||||
// Skip internal providers
|
||||
if localName == "terraform" {
|
||||
continue
|
||||
}
|
||||
|
||||
// If no explicit provider configuration exists for this local
|
||||
// name, add one with a legacy provider address.
|
||||
if _, exist := requiredProviders[localName]; !exist {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
provider foo {
|
||||
provider "foo" {
|
||||
version = "1.2.3"
|
||||
}
|
||||
|
||||
|
@ -17,3 +17,5 @@ terraform {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "terraform" {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
provider foo {
|
||||
provider "foo" {
|
||||
version = "1.2.3"
|
||||
}
|
||||
|
||||
|
@ -10,3 +10,5 @@ terraform {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "terraform" { }
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
resource foo_resource b {}
|
||||
resource bar_resource c {}
|
||||
resource bar_resource ab {
|
||||
resource "foo_resource" "b" {}
|
||||
resource "bar_resource" "c" {}
|
||||
resource "bar_resource" "ab" {
|
||||
provider = baz
|
||||
}
|
||||
resource "terraform_remote_state" "production" {}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
resource foo_resource b {}
|
||||
resource bar_resource c {}
|
||||
resource bar_resource ab {
|
||||
resource "foo_resource" "b" {}
|
||||
resource "bar_resource" "c" {}
|
||||
resource "bar_resource" "ab" {
|
||||
provider = baz
|
||||
}
|
||||
resource "terraform_remote_state" "production" {}
|
||||
|
|
Loading…
Reference in New Issue