Files
opentf/website/docs/commands/providers/mirror.html.md
Martin Atkins 49e2e00231 command: terraform providers mirror
This new command is intended to make it easy to create or update a mirror
directory containing suitable providers for the current configuration,
producing a layout that is appropriate both for a filesystem mirror or,
if copied into the document root of an HTTP server, a network mirror.

This initial version is not customizable aside from being able to select
multiple platforms to install packages for.

Future iterations of this could include commands to turn the JSON index
generation on and off, or to instruct it to produce the unpacked directory
layout instead of the packed directory layout as it currently does. Both
of those options would make the generated directory unsuitable to be
a network mirror, but it would still work as a filesystem mirror.

In the long run this will hopefully form part of a replacement workflow to
terraform-bundle as a way to put copies of providers somewhere so we don't
need to re-download them every time, but some other changes will be needed
outside of just this command before that'd be true, such as adding support
for network and/or filesystem mirrors in Terraform Enterprise.
2020-06-01 14:49:43 -07:00

2.7 KiB

layout, page_title, sidebar_current, description
layout page_title sidebar_current description
commands-providers Command: providers mirror docs-commands-providers-mirror The `terraform providers mirror` command downloads the providers required for the current configuration and copies them into a directory in the local filesystem.

Command: terraform providers mirror

The terraform providers mirror command downloads the providers required for the current configuration and copies them into a directory in the local filesystem.

In normal use, terraform init will automatically download needed providers from provider registries as part of initializing the current working directory. Sometimes Terraform is running in an environment where that isn't possible, such as on an isolated network without access to the Terraform Registry. In that case, explicit installation method configuration allows you to configure Terraform, when running on a particular system, to consult only a local filesystem directory where you've created a local mirror of the necessary plugins, and to skip accessing the upstream registry at all.

The terraform providers mirror command can automatically populate a directory that will be used as a local filesystem mirror in the provider installation configuration.

-> terraform providers mirror is available only in Terraform v0.13 or later.

Usage

Usage: terraform providers mirror [options] <target-dir>

A single target directory is required. Terraform will create under that directory the path structure that is expected for filesystem-based provider plugin mirrors, populating it both with .zip files containing the plugins themselves and .json index files that describe what is available in the directory.

This command supports the following additional option:

  • -platform=OS_ARCH - Choose which target platform to build a mirror for. By default Terraform will obtain plugin packages suitable for the platform where you run this command. Use this flag multiple times to include packages for multiple target systems.

    Target platform names names consist of an operating system and a CPU architecture. For example, linux_amd64 selects the Linux operating system running on an AMD64 or x86_64 CPU.

You can run terraform providers mirror again on an existing mirror directory to update it with new packages. For example, you can add packages for a new target platform by re-running the command with the desired new -platform=... option, and it will place the packages for that new platform without removing packages you previously downloaded, merging the resulting set of packages together to update the JSON index files.