> ## Documentation Index
> Fetch the complete documentation index at: https://cdktn.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Java: LocalExecProvisioner

> CDKTN Core API Reference for LocalExecProvisioner in Java.

The local-exec provisioner invokes a local executable after a resource is created.

This invokes a process on the machine running Terraform, not on the resource.

See [local-exec](https://developer.hashicorp.com/terraform/language/resources/provisioners/local-exec)

## Initializer <a name="Initializer" id="cdktn.LocalExecProvisioner.Initializer" />

```java theme={null}
import io.cdktn.cdktn.LocalExecProvisioner;

LocalExecProvisioner.builder()
    .command(java.lang.String)
    .type(java.lang.String)
//  .environment(java.util.Map<java.lang.String, java.lang.String>)
//  .interpreter(java.util.List<java.lang.String>)
//  .when(java.lang.String)
//  .workingDir(java.lang.String)
    .build();
```

## Properties <a name="Properties" id="Properties" />

| **Name**                                                                                | **Type**                                                          | **Description**                                                                   |
| --------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| <code><a href="#cdktn.LocalExecProvisioner.property.command">command</a></code>         | <code>java.lang.String</code>                                     | This is the command to execute.                                                   |
| <code><a href="#cdktn.LocalExecProvisioner.property.type">type</a></code>               | <code>java.lang.String</code>                                     | *No description.*                                                                 |
| <code><a href="#cdktn.LocalExecProvisioner.property.environment">environment</a></code> | <code>java.util.Map\< java.lang.String, java.lang.String ></code> | A record of key value pairs representing the environment of the executed command. |
| <code><a href="#cdktn.LocalExecProvisioner.property.interpreter">interpreter</a></code> | <code>java.util.List\< java.lang.String ></code>                  | If provided, this is a list of interpreter arguments used to execute the command. |
| <code><a href="#cdktn.LocalExecProvisioner.property.when">when</a></code>               | <code>java.lang.String</code>                                     | If provided, specifies when Terraform will execute the command.                   |
| <code><a href="#cdktn.LocalExecProvisioner.property.workingDir">workingDir</a></code>   | <code>java.lang.String</code>                                     | If provided, specifies the working directory where command will be executed.      |

***

### `command`<sup>Required</sup> <a name="command" id="cdktn.LocalExecProvisioner.property.command" />

```java theme={null}
public java.lang.String getCommand();
```

* *Type:* java.lang.String

This is the command to execute.

It can be provided as a relative path to the current working directory or as an absolute path.
It is evaluated in a shell, and can use environment variables or Terraform variables.

***

### `type`<sup>Required</sup> <a name="type" id="cdktn.LocalExecProvisioner.property.type" />

```java theme={null}
public java.lang.String getType();
```

* *Type:* java.lang.String

***

### `environment`<sup>Optional</sup> <a name="environment" id="cdktn.LocalExecProvisioner.property.environment" />

```java theme={null}
public java.util.Map<java.lang.String, java.lang.String> getEnvironment();
```

* *Type:* java.util.Map\< java.lang.String, java.lang.String >

A record of key value pairs representing the environment of the executed command.

It inherits the current process environment.

***

### `interpreter`<sup>Optional</sup> <a name="interpreter" id="cdktn.LocalExecProvisioner.property.interpreter" />

```java theme={null}
public java.util.List<java.lang.String> getInterpreter();
```

* *Type:* java.util.List\< java.lang.String >

If provided, this is a list of interpreter arguments used to execute the command.

The first argument is the interpreter itself.
It can be provided as a relative path to the current working directory or as an absolute path
The remaining arguments are appended prior to the command.
This allows building command lines of the form "/bin/bash", "-c", "echo foo".
If interpreter is unspecified, sensible defaults will be chosen based on the system OS.

***

### `when`<sup>Optional</sup> <a name="when" id="cdktn.LocalExecProvisioner.property.when" />

```java theme={null}
public java.lang.String getWhen();
```

* *Type:* java.lang.String

If provided, specifies when Terraform will execute the command.

For example, when = destroy specifies that the provisioner will run when the associated resource is destroyed

***

### `workingDir`<sup>Optional</sup> <a name="workingDir" id="cdktn.LocalExecProvisioner.property.workingDir" />

```java theme={null}
public java.lang.String getWorkingDir();
```

* *Type:* java.lang.String

If provided, specifies the working directory where command will be executed.

It can be provided as a relative path to the current working directory or as an absolute path.
The directory must exist.

***
