create service opentofu plan
  • 12 Nov 2024
  • Dark
    Light
  • PDF

create service opentofu plan

  • Dark
    Light
  • PDF

Article summary

iagctl create service opentofu-plan

Create a new OpenTofu plan service

Synopsis

This command will create an OpenTofu plan service in the gateway data store. The service can later be executed via gateway run command. Before creating an OpenTofu plan service, you will need to ensure that a repository with the actual plan files exists. See iagctl create repository -h for more information.

Consider an OpenTofu plan that exists in a repository called example-repo. The repository has the following directory layout:

├── README.md
├── deployment-plans
│   ├── main.tf
│   └── prod.tfvars

You can specify that you want to use example-repo via the --repository flag.

Notice that your OpenTofu plan files exist in a directory called deployment-plans. You can denote this using the --working-dir flag.

Any variables that are required by the plan can be specified using the --var flag. The variables can be specified using key=value syntax.

A file within the repository that contains variables can be specified using the --var-file flag. The file must exist within the repository and the path to the file must be relative to your working-dir.

Finally, a decorator can be specified to allow for input validation when the service is executed via the run command. For more information on decorators, run iagctl create decorator -h.

iagctl create service opentofu-plan <service-name> --repository <name> [flags]

Examples

Create a Simple OpenTofu Service

Creates a simple OpenTofu service called my-opentofu-service where the plan files are located at the root of the my-repo repository.

>_ iagctl create service opentofu-plan my-opentofu-service \
--repository my-repo

Create a Complex OpenTofu Service

Creates an OpenTofu service that takes advantage of every available option.

>_ iagctl create service opentofu-plan deployment-service \
--repository example-repo \
--working-dir deployment-plans \
--var server_name=examplehostname \
--var-file prod.tfvars \
--decorator my-decorator \
--description "An OpenTofu plan to deploy servers" \
--tag servers

Options

--decorator string       The name of the decorator to be associated with the service
--description string     A brief description of the service
-h, --help               Help for OpenTofu plan
--repository string      The repository that contains the OpenTofu plan
--tag stringArray        Metadata tags to associate with the service
--var stringArray        A key value pair separated by a '=' character to be used by OpenTofu during a plan execution
--var-file stringArray   The path to a variable file to be used by OpenTofu during a plan execution. Must be relative to the 'working-dir'
--working-dir string     The path to the directory where the plan exists. The path must be relative to the root of the repository

Options Inherited from Parent Commands

  --config string   Path to the configuration file
  --raw             Displays the result of the command in its raw format
  --verbose         Enable verbose output

CLI References

See related create commands:

For all CLI commands see → Command References Index


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.