docs: update 'Use OpenTofu as Docker Image' documentation (#1705)

Signed-off-by: eduardo <eduardoslafiq@gmail.com>
This commit is contained in:
edualb 2024-06-18 07:34:31 -03:00 committed by GitHub
parent 2d72c90de1
commit 3fdc809050
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 9 deletions

View File

@ -32,6 +32,17 @@ To pull platform-specific images (`amd64`, `arm`, `arm64`, `386`) use:
## Usage
:::note
If you run into rate limiting issues with GitHub, create a
[Personal Access Token](https://github.com/settings/tokens) and
[log in](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry)
to the registry.
:::
:::note
In the examples below you should have at least one `.tf` file located in the folder you are running the `docker` command.
:::
To pull the image from GitHub Packages registry:
<CodeBlock language="bash">{DockerPullScript}</CodeBlock>
@ -39,12 +50,3 @@ To pull the image from GitHub Packages registry:
To run OpenTofu as a Docker container:
<CodeBlock language="bash">{DockerRunScript}</CodeBlock>
:::tip
If you run into rate limiting issues with GitHub, create a
[Personal Access Token](https://github.com/settings/tokens) and
[log in](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry)
to the registry.
:::

View File

@ -1,5 +1,20 @@
# Init providers plugins
docker run \
--workdir=/srv/workspace \
--mount type=bind,source=.,target=/srv/workspace \
ghcr.io/opentofu/opentofu:latest \
init
# Creating plan file
docker run \
--workdir=/srv/workspace \
--mount type=bind,source=.,target=/srv/workspace \
ghcr.io/opentofu/opentofu:latest \
plan -out=main.plan
# Applying plan file
docker run \
--workdir=/srv/workspace \
--mount type=bind,source=.,target=/srv/workspace \
ghcr.io/opentofu/opentofu:latest \
apply "/srv/workspace/main.plan"