getTag

suspend fun getTag(argument: GetTagPlainArgs): GetTagResult

Get information on a tag. This data source provides the name as configured on your DigitalOcean account. This is useful if the tag name in question is not managed by the provider or you need validate if the tag exists in the account. An error is triggered if the provided tag name does not exist.

Example Usage

Get the tag:

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetTagArgs;
import com.pulumi.digitalocean.Droplet;
import com.pulumi.digitalocean.DropletArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var exampleTag = DigitaloceanFunctions.getTag(GetTagArgs.builder()
.name("example")
.build());
var exampleDroplet = new Droplet("exampleDroplet", DropletArgs.builder()
.image("ubuntu-18-04-x64")
.region("nyc2")
.size("s-1vcpu-1gb")
.tags(exampleTag.applyValue(getTagResult -> getTagResult.name()))
.build());
}
}

Return

A collection of values returned by getTag.

Parameters

argument

A collection of arguments for invoking getTag.


suspend fun getTag(name: String): GetTagResult

Return

A collection of values returned by getTag.

See also

Parameters

name

The name of the tag.


suspend fun getTag(argument: suspend GetTagPlainArgsBuilder.() -> Unit): GetTagResult

Return

A collection of values returned by getTag.

See also

Parameters

argument

Builder for com.pulumi.digitalocean.kotlin.inputs.GetTagPlainArgs.