> ## 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: CloudBackend

> CDKTN Core API Reference for CloudBackend in Java.

The Cloud Backend synthesizes a [cloud block](https://developer.hashicorp.com/terraform/cli/cloud/settings#the-cloud-block). The cloud block is a nested block within the top-level terraform settings block. It specifies which Terraform Cloud workspaces to use for the current working directory. The cloud block only affects Terraform CLI's behavior. When Terraform Cloud uses a configuration that contains a cloud block - for example, when a workspace is configured to use a VCS provider directly - it ignores the block and behaves according to its own workspace settings.

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

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

CloudBackend.Builder.create(Construct scope)
    .organization(java.lang.String)
    .workspaces(NamedCloudWorkspace|TaggedCloudWorkspaces)
//  .hostname(java.lang.String)
//  .token(java.lang.String)
    .build();
```

| **Name**                                                                                       | **Type**                                                                                                                                    | **Description**                                                                                             |
| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| <code><a href="#cdktn.CloudBackend.Initializer.parameter.scope">scope</a></code>               | <code>software.constructs.Construct</code>                                                                                                  | *No description.*                                                                                           |
| <code><a href="#cdktn.CloudBackend.Initializer.parameter.organization">organization</a></code> | <code>java.lang.String</code>                                                                                                               | The name of the organization containing the workspace(s) the current configuration should use.              |
| <code><a href="#cdktn.CloudBackend.Initializer.parameter.workspaces">workspaces</a></code>     | <code><a href="#cdktn.NamedCloudWorkspace">NamedCloudWorkspace</a>\|<a href="#cdktn.TaggedCloudWorkspaces">TaggedCloudWorkspaces</a></code> | A nested block that specifies which remote Terraform Cloud workspaces to use for the current configuration. |
| <code><a href="#cdktn.CloudBackend.Initializer.parameter.hostname">hostname</a></code>         | <code>java.lang.String</code>                                                                                                               | The hostname of a Terraform Enterprise installation, if using Terraform Enterprise.                         |
| <code><a href="#cdktn.CloudBackend.Initializer.parameter.token">token</a></code>               | <code>java.lang.String</code>                                                                                                               | The token used to authenticate with Terraform Cloud.                                                        |

***

### `scope`<sup>Required</sup> <a name="scope" id="cdktn.CloudBackend.Initializer.parameter.scope" />

* *Type:* software.constructs.Construct

***

### `organization`<sup>Required</sup> <a name="organization" id="cdktn.CloudBackend.Initializer.parameter.organization" />

* *Type:* java.lang.String

The name of the organization containing the workspace(s) the current configuration should use.

***

### `workspaces`<sup>Required</sup> <a name="workspaces" id="cdktn.CloudBackend.Initializer.parameter.workspaces" />

* *Type:* <a href="#cdktn.NamedCloudWorkspace">NamedCloudWorkspace</a>|<a href="#cdktn.TaggedCloudWorkspaces">TaggedCloudWorkspaces</a>

A nested block that specifies which remote Terraform Cloud workspaces to use for the current configuration.

The workspaces block must contain exactly one of the following arguments, each denoting a strategy for how workspaces should be mapped:

***

### `hostname`<sup>Optional</sup> <a name="hostname" id="cdktn.CloudBackend.Initializer.parameter.hostname" />

* *Type:* java.lang.String
* *Default:* app.terraform.io

The hostname of a Terraform Enterprise installation, if using Terraform Enterprise.

***

### `token`<sup>Optional</sup> <a name="token" id="cdktn.CloudBackend.Initializer.parameter.token" />

* *Type:* java.lang.String

The token used to authenticate with Terraform Cloud.

We recommend omitting the token from the configuration, and instead using terraform login or manually configuring credentials in the CLI config file.

***

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

| **Name**                                                                                         | **Description**                                                                   |
| ------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
| <code><a href="#cdktn.CloudBackend.toString">toString</a></code>                                 | Returns a string representation of this construct.                                |
| <code><a href="#cdktn.CloudBackend.with">with</a></code>                                         | Applies one or more mixins to this construct.                                     |
| <code><a href="#cdktn.CloudBackend.addOverride">addOverride</a></code>                           | *No description.*                                                                 |
| <code><a href="#cdktn.CloudBackend.overrideLogicalId">overrideLogicalId</a></code>               | Overrides the auto-generated logical ID with a specific ID.                       |
| <code><a href="#cdktn.CloudBackend.resetOverrideLogicalId">resetOverrideLogicalId</a></code>     | Resets a previously passed logical Id to use the auto-generated logical id again. |
| <code><a href="#cdktn.CloudBackend.toHclTerraform">toHclTerraform</a></code>                     | *No description.*                                                                 |
| <code><a href="#cdktn.CloudBackend.toMetadata">toMetadata</a></code>                             | *No description.*                                                                 |
| <code><a href="#cdktn.CloudBackend.toTerraform">toTerraform</a></code>                           | Adds this resource to the terraform JSON output.                                  |
| <code><a href="#cdktn.CloudBackend.getRemoteStateDataSource">getRemoteStateDataSource</a></code> | Creates a TerraformRemoteState resource that accesses this backend.               |

***

### `toString` <a name="toString" id="cdktn.CloudBackend.toString" />

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

Returns a string representation of this construct.

### `with` <a name="with" id="cdktn.CloudBackend.with" />

```java theme={null}
public IConstruct with(IMixin... mixins)
```

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple `with()` calls if subsequent mixins should apply to added
constructs.

#### `mixins`<sup>Required</sup> <a name="mixins" id="cdktn.CloudBackend.with.parameter.mixins" />

* *Type:* software.constructs.IMixin...

The mixins to apply.

***

### `addOverride` <a name="addOverride" id="cdktn.CloudBackend.addOverride" />

```java theme={null}
public void addOverride(java.lang.String path, java.lang.Object value)
```

#### `path`<sup>Required</sup> <a name="path" id="cdktn.CloudBackend.addOverride.parameter.path" />

* *Type:* java.lang.String

***

#### `value`<sup>Required</sup> <a name="value" id="cdktn.CloudBackend.addOverride.parameter.value" />

* *Type:* java.lang.Object

***

### `overrideLogicalId` <a name="overrideLogicalId" id="cdktn.CloudBackend.overrideLogicalId" />

```java theme={null}
public void overrideLogicalId(java.lang.String newLogicalId)
```

Overrides the auto-generated logical ID with a specific ID.

#### `newLogicalId`<sup>Required</sup> <a name="newLogicalId" id="cdktn.CloudBackend.overrideLogicalId.parameter.newLogicalId" />

* *Type:* java.lang.String

The new logical ID to use for this stack element.

***

### `resetOverrideLogicalId` <a name="resetOverrideLogicalId" id="cdktn.CloudBackend.resetOverrideLogicalId" />

```java theme={null}
public void resetOverrideLogicalId()
```

Resets a previously passed logical Id to use the auto-generated logical id again.

### `toHclTerraform` <a name="toHclTerraform" id="cdktn.CloudBackend.toHclTerraform" />

```java theme={null}
public java.lang.Object toHclTerraform()
```

### `toMetadata` <a name="toMetadata" id="cdktn.CloudBackend.toMetadata" />

```java theme={null}
public java.lang.Object toMetadata()
```

### `toTerraform` <a name="toTerraform" id="cdktn.CloudBackend.toTerraform" />

```java theme={null}
public java.lang.Object toTerraform()
```

Adds this resource to the terraform JSON output.

### `getRemoteStateDataSource` <a name="getRemoteStateDataSource" id="cdktn.CloudBackend.getRemoteStateDataSource" />

```java theme={null}
public TerraformRemoteState getRemoteStateDataSource(Construct scope, java.lang.String name, java.lang.String _fromStack)
```

Creates a TerraformRemoteState resource that accesses this backend.

#### `scope`<sup>Required</sup> <a name="scope" id="cdktn.CloudBackend.getRemoteStateDataSource.parameter.scope" />

* *Type:* software.constructs.Construct

***

#### `name`<sup>Required</sup> <a name="name" id="cdktn.CloudBackend.getRemoteStateDataSource.parameter.name" />

* *Type:* java.lang.String

***

#### `_fromStack`<sup>Required</sup> <a name="_fromStack" id="cdktn.CloudBackend.getRemoteStateDataSource.parameter._fromStack" />

* *Type:* java.lang.String

***

## Static Functions <a name="Static Functions" id="Static Functions" />

| **Name**                                                                             | **Description**               |
| ------------------------------------------------------------------------------------ | ----------------------------- |
| <code><a href="#cdktn.CloudBackend.isConstruct">isConstruct</a></code>               | Checks if `x` is a construct. |
| <code><a href="#cdktn.CloudBackend.isTerraformElement">isTerraformElement</a></code> | *No description.*             |
| <code><a href="#cdktn.CloudBackend.isBackend">isBackend</a></code>                   | *No description.*             |

***

### `isConstruct` <a name="isConstruct" id="cdktn.CloudBackend.isConstruct" />

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

CloudBackend.isConstruct(java.lang.Object x)
```

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct`
instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on
disk are seen as independent, completely different libraries. As a
consequence, the class `Construct` in each copy of the `constructs` library
is seen as a different class, and an instance of one class will not test as
`instanceof` the other class. `npm install` will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the `constructs`
library can be accidentally installed, and `instanceof` will behave
unpredictably. It is safest to avoid using `instanceof`, and using
this type-testing method instead.

#### `x`<sup>Required</sup> <a name="x" id="cdktn.CloudBackend.isConstruct.parameter.x" />

* *Type:* java.lang.Object

Any object.

***

### `isTerraformElement` <a name="isTerraformElement" id="cdktn.CloudBackend.isTerraformElement" />

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

CloudBackend.isTerraformElement(java.lang.Object x)
```

#### `x`<sup>Required</sup> <a name="x" id="cdktn.CloudBackend.isTerraformElement.parameter.x" />

* *Type:* java.lang.Object

***

### `isBackend` <a name="isBackend" id="cdktn.CloudBackend.isBackend" />

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

CloudBackend.isBackend(java.lang.Object x)
```

#### `x`<sup>Required</sup> <a name="x" id="cdktn.CloudBackend.isBackend.parameter.x" />

* *Type:* java.lang.Object

***

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

| **Name**                                                                                  | **Type**                                                        | **Description**   |
| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ----------------- |
| <code><a href="#cdktn.CloudBackend.property.node">node</a></code>                         | <code>software.constructs.Node</code>                           | The tree node.    |
| <code><a href="#cdktn.CloudBackend.property.cdktfStack">cdktfStack</a></code>             | <code><a href="#cdktn.TerraformStack">TerraformStack</a></code> | *No description.* |
| <code><a href="#cdktn.CloudBackend.property.fqn">fqn</a></code>                           | <code>java.lang.String</code>                                   | *No description.* |
| <code><a href="#cdktn.CloudBackend.property.friendlyUniqueId">friendlyUniqueId</a></code> | <code>java.lang.String</code>                                   | *No description.* |

***

### `node`<sup>Required</sup> <a name="node" id="cdktn.CloudBackend.property.node" />

```java theme={null}
public Node getNode();
```

* *Type:* software.constructs.Node

The tree node.

***

### `cdktfStack`<sup>Required</sup> <a name="cdktfStack" id="cdktn.CloudBackend.property.cdktfStack" />

```java theme={null}
public TerraformStack getCdktfStack();
```

* *Type:* <a href="#cdktn.TerraformStack">TerraformStack</a>

***

### `fqn`<sup>Required</sup> <a name="fqn" id="cdktn.CloudBackend.property.fqn" />

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

* *Type:* java.lang.String

***

### `friendlyUniqueId`<sup>Required</sup> <a name="friendlyUniqueId" id="cdktn.CloudBackend.property.friendlyUniqueId" />

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

* *Type:* java.lang.String

***
