pulumi/tests/testdata/codegen/assets-and-archives/docs/resourcewithassets/_index.md

40 KiB


title: "ResourceWithAssets" title_tag: "example.ResourceWithAssets" meta_desc: "Documentation for the example.ResourceWithAssets resource with examples, input properties, output properties, lookup functions, and supporting types." layout: api no_edit_this_page: true

Create ResourceWithAssets Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ResourceWithAssets(name: string, args: ResourceWithAssetsArgs, opts?: CustomResourceOptions);
@overload
def ResourceWithAssets(resource_name: str,
                       args: ResourceWithAssetsArgs,
                       opts: Optional[ResourceOptions] = None)

@overload
def ResourceWithAssets(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       source: Optional[Union[pulumi.Asset, pulumi.Archive]] = None,
                       archive: Optional[pulumi.Archive] = None,
                       nested: Optional[TypeWithAssetsArgs] = None)
func NewResourceWithAssets(ctx *Context, name string, args ResourceWithAssetsArgs, opts ...ResourceOption) (*ResourceWithAssets, error)
public ResourceWithAssets(string name, ResourceWithAssetsArgs args, CustomResourceOptions? opts = null)
public ResourceWithAssets(String name, ResourceWithAssetsArgs args)
public ResourceWithAssets(String name, ResourceWithAssetsArgs args, CustomResourceOptions options)
type: example:ResourceWithAssets
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name string
The unique name of the resource.
args ResourceWithAssetsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ResourceWithAssetsArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ResourceWithAssetsArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ResourceWithAssetsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ResourceWithAssetsArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var resourceWithAssetsResource = new Example.ResourceWithAssets("resourceWithAssetsResource", new()
{
    Source = new StringAsset("content"),
    Archive = new FileArchive("./path/to/archive"),
    Nested = new Example.Inputs.TypeWithAssetsArgs
    {
        Asset = new StringAsset("content"),
        PlainArchive = new FileArchive("./path/to/archive"),
        Archive = new FileArchive("./path/to/archive"),
        PlainAsset = new StringAsset("content"),
    },
});
example, err := example.NewResourceWithAssets(ctx, "resourceWithAssetsResource", &example.ResourceWithAssetsArgs{
	Source:  pulumi.NewStringAsset("content"),
	Archive: pulumi.NewFileArchive("./path/to/archive"),
	Nested: &example.TypeWithAssetsArgs{
		Asset:        pulumi.NewStringAsset("content"),
		PlainArchive: pulumi.NewFileArchive("./path/to/archive"),
		Archive:      pulumi.NewFileArchive("./path/to/archive"),
		PlainAsset:   pulumi.NewStringAsset("content"),
	},
})
var resourceWithAssetsResource = new ResourceWithAssets("resourceWithAssetsResource", ResourceWithAssetsArgs.builder()
    .source(new StringAsset("content"))
    .archive(new FileArchive("./path/to/archive"))
    .nested(TypeWithAssetsArgs.builder()
        .asset(new StringAsset("content"))
        .plainArchive(new FileArchive("./path/to/archive"))
        .archive(new FileArchive("./path/to/archive"))
        .plainAsset(new StringAsset("content"))
        .build())
    .build());
resource_with_assets_resource = example.ResourceWithAssets("resourceWithAssetsResource",
    source=pulumi.StringAsset("content"),
    archive=pulumi.FileArchive("./path/to/archive"),
    nested={
        "asset": pulumi.StringAsset("content"),
        "plain_archive": pulumi.FileArchive("./path/to/archive"),
        "archive": pulumi.FileArchive("./path/to/archive"),
        "plain_asset": pulumi.StringAsset("content"),
    })
const resourceWithAssetsResource = new example.ResourceWithAssets("resourceWithAssetsResource", {
    source: new pulumi.asset.StringAsset("content"),
    archive: new pulumi.asset.FileArchive("./path/to/archive"),
    nested: {
        asset: new pulumi.asset.StringAsset("content"),
        plainArchive: new pulumi.asset.FileArchive("./path/to/archive"),
        archive: new pulumi.asset.FileArchive("./path/to/archive"),
        plainAsset: new pulumi.asset.StringAsset("content"),
    },
});
type: example:ResourceWithAssets
properties:
    archive:
        fn::FileArchive: ./path/to/archive
    nested:
        archive:
            fn::FileArchive: ./path/to/archive
        asset:
            fn::StringAsset: content
        plainArchive:
            fn::FileArchive: ./path/to/archive
        plainAsset:
            fn::StringAsset: content
    source:
        fn::StringAsset: content

ResourceWithAssets Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ResourceWithAssets resource accepts the following input properties:

Source AssetOrArchive
Archive Archive
Nested TypeWithAssets
Source pulumi.AssetOrArchive
Archive pulumi.Archive
Nested TypeWithAssetsArgs
source AssetOrArchive
archive Archive
nested TypeWithAssets
source pulumi.asset.Asset | pulumi.asset.Archive
archive pulumi.asset.Archive
nested TypeWithAssets
source Union[pulumi.Asset, pulumi.Archive]
archive pulumi.Archive
nested TypeWithAssetsArgs

Outputs

All input properties are implicitly available as output properties. Additionally, the ResourceWithAssets resource produces the following output properties:

Asset AssetOrArchive
Id string
The provider-assigned unique ID for this managed resource.
Asset pulumi.AssetOrArchive
Id string
The provider-assigned unique ID for this managed resource.
asset AssetOrArchive
id String
The provider-assigned unique ID for this managed resource.
asset pulumi.asset.Asset | pulumi.asset.Archive
id string
The provider-assigned unique ID for this managed resource.
asset Union[pulumi.Asset, pulumi.Archive]
id str
The provider-assigned unique ID for this managed resource.
asset Asset
id String
The provider-assigned unique ID for this managed resource.

Supporting Types

TypeWithAssets, TypeWithAssetsArgs

Asset AssetOrArchive
PlainArchive Archive
Archive Archive
PlainAsset AssetOrArchive
Asset pulumi.AssetOrArchive
PlainArchive pulumi.Archive
Archive pulumi.Archive
PlainAsset pulumi.AssetOrArchive
asset AssetOrArchive
plainArchive Archive
archive Archive
plainAsset AssetOrArchive
asset pulumi.asset.Asset | pulumi.asset.Archive
plainArchive pulumi.asset.Archive
archive pulumi.asset.Archive
plainAsset pulumi.asset.Asset | pulumi.asset.Archive
asset Union[pulumi.Asset, pulumi.Archive]
plain_archive pulumi.Archive
archive pulumi.Archive
plain_asset Union[pulumi.Asset, pulumi.Archive]
asset Asset
plainArchive Archive
archive Archive
plainAsset Asset

Package Details

Repository
example
License