> ## 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.

# Python: Resource

> CDKTN Core API Reference for Resource in Python.

* *Implements:* <a href="#cdktn.IResource">IResource</a>

A construct which represents a resource.

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

```python theme={null}
import cdktn

cdktn.Resource(
  scope: Construct,
  id: str
)
```

| **Name**                                                                     | **Type**                          | **Description**   |
| ---------------------------------------------------------------------------- | --------------------------------- | ----------------- |
| <code><a href="#cdktn.Resource.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
| <code><a href="#cdktn.Resource.Initializer.parameter.id">id</a></code>       | <code>str</code>                  | *No description.* |

***

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

* *Type:* constructs.Construct

***

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

* *Type:* str

***

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

| **Name**                                                       | **Description**                                    |
| -------------------------------------------------------------- | -------------------------------------------------- |
| <code><a href="#cdktn.Resource.toString">to\_string</a></code> | Returns a string representation of this construct. |
| <code><a href="#cdktn.Resource.with">with</a></code>           | Applies one or more mixins to this construct.      |

***

### ~~`to_string`~~ <a name="to_string" id="cdktn.Resource.toString" />

```python theme={null}
def to_string() -> str
```

Returns a string representation of this construct.

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

```python theme={null}
def with(
  mixins: *IMixin
) -> IConstruct
```

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.Resource.with.parameter.mixins" />

* *Type:* \*constructs.IMixin

The mixins to apply.

***

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

| **Name**                                                             | **Description**               |
| -------------------------------------------------------------------- | ----------------------------- |
| <code><a href="#cdktn.Resource.isConstruct">is\_construct</a></code> | Checks if `x` is a construct. |

***

### ~~`is_construct`~~ <a name="is_construct" id="cdktn.Resource.isConstruct" />

```python theme={null}
import cdktn

cdktn.Resource.is_construct(
  x: typing.Any
)
```

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.Resource.isConstruct.parameter.x" />

* *Type:* typing.Any

Any object.

***

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

| **Name**                                                        | **Type**                                                        | **Description**                              |
| --------------------------------------------------------------- | --------------------------------------------------------------- | -------------------------------------------- |
| <code><a href="#cdktn.Resource.property.node">node</a></code>   | <code>constructs.Node</code>                                    | The tree node.                               |
| <code><a href="#cdktn.Resource.property.stack">stack</a></code> | <code><a href="#cdktn.TerraformStack">TerraformStack</a></code> | The stack in which this resource is defined. |

***

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

* *Deprecated:* - Please use Construct from the constructs package instead.

```python theme={null}
node: Node
```

* *Type:* constructs.Node

The tree node.

***

### ~~`stack`~~<sup>Required</sup> <a name="stack" id="cdktn.Resource.property.stack" />

* *Deprecated:* - Please use Construct from the constructs package instead.

```python theme={null}
stack: TerraformStack
```

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

The stack in which this resource is defined.

***
