github.com/hugorut/terraform@v1.1.3/website/docs/cli/commands/providers/mirror.mdx (about)

     1  ---
     2  page_title: 'Command: providers mirror'
     3  description: |-
     4    The `terraform providers mirror` command downloads the providers required
     5    for the current configuration and copies them into a directory in the local
     6    filesystem.
     7  ---
     8  
     9  # Command: terraform providers mirror
    10  
    11  The `terraform providers mirror` command downloads the providers required
    12  for the current configuration and copies them into a directory in the local
    13  filesystem.
    14  
    15  In normal use, `terraform init` will automatically download needed providers
    16  from provider registries as part of initializing the current working directory.
    17  Sometimes Terraform is running in an environment where that isn't possible,
    18  such as on an isolated network without access to the Terraform Registry. In
    19  that case,
    20  [explicit installation method configuration](/cli/config/config-file#explicit-installation-method-configuration)
    21  allows you to configure Terraform, when running on a particular system, to
    22  consult only a local filesystem directory where you've created a local mirror
    23  of the necessary plugins, and to skip accessing the upstream registry at all.
    24  
    25  The `terraform providers mirror` command can automatically populate a directory
    26  that will be used as a local filesystem mirror in the provider installation
    27  configuration.
    28  
    29  -> `terraform providers mirror` is available only in Terraform v0.13 or later.
    30  
    31  ## Usage
    32  
    33  Usage: `terraform providers mirror [options] <target-dir>`
    34  
    35  A single target directory is required. Terraform will create under that
    36  directory the path structure that is expected for filesystem-based provider
    37  plugin mirrors, populating it with `.zip` files containing the plugins
    38  themselves.
    39  
    40  Terraform will also generate various `.json` index files which contain suitable
    41  responses to implement
    42  [the network mirror protocol](/internals/provider-network-mirror-protocol),
    43  if you upload the resulting directory to a static website host. Terraform
    44  ignores those index files when using the directory as a filesystem mirror,
    45  because the directory entries themselves are authoritative in that case.
    46  
    47  This command supports the following additional option:
    48  
    49  * `-platform=OS_ARCH` - Choose which target platform to build a mirror for.
    50    By default Terraform will obtain plugin packages suitable for the platform
    51    where you run this command. Use this flag multiple times to include packages
    52    for multiple target systems.
    53  
    54    Target platform names consist of an operating system and a CPU
    55    architecture. For example, `linux_amd64` selects the Linux operating system
    56    running on an AMD64 or x86_64 CPU.
    57  
    58  You can run `terraform providers mirror` again on an existing mirror directory
    59  to update it with new packages. For example, you can add packages for a new
    60  target platform by re-running the command with the desired new `-platform=...`
    61  option, and it will place the packages for that new platform without removing
    62  packages you previously downloaded, merging the resulting set of packages
    63  together to update the JSON index files.