-
Notifications
You must be signed in to change notification settings - Fork 25
Terraform custom provider initialization
Terraform provides and regularly updates documentation to create and use custom providers. Refer link.
For Terraform version < 0.13, it was simple to use custom providers and they simply had to reside in the Terraform working directory.
From Terraform version > 0.13, the process has become a bit complicated. Refer to the Terraform documentation for more information.
Terraform now requires you have a specific set of directories for having local providers. This is so that Terraform knows where to look when initiating. It also enables Terraform to download modules it needs from the registry. In the case of JTAF and because we're building providers for local use, you will need to create a default set of directories for Terraform. The hierarchy is below. Take note of the version numbers etc. They're important when using Terraform and newly created providers.
.terraform.d
├── checkpoint_cache
├── checkpoint_signature
└── plugins
└── juniper
└── providers
└── junos-vsrx
└── 20.32.0101
├── darwin_amd64
│ └── terraform-provider-junos-vsrx
└── linux_amd64
In our case, the provider name junos-vsrx
is important and the version number.
Note that there is a provider in this example in the darwin_amd64
direcetory. Notes on the layout of these directories can be found in the Terraform documentation.
The version number is mentioned elsewhere, but for clarity, the number is explained as thus: version: 20.32.0101 explanation: 20.3R2.1 version of Junos and our build of the provider is 01 (the last two digits).