getDefaultTags

Use this data source to get the default tags configured on the provider.

With this data source, you can apply default tags to resources not directly managed by a resource, such as the instances underneath an Auto Scaling group or the volumes created for an EC2 instance.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.GetDefaultTags.Invoke();

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err = aws.GetDefaultTags(ctx, nil, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetDefaultTagsArgs;
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 example = AwsFunctions.getDefaultTags();

    }
}
import pulumi
import pulumi_aws as aws

example = aws.get_default_tags()
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.getDefaultTags({});
variables:
  example:
    fn::invoke:
      Function: aws:getDefaultTags
      Arguments: {}

Dynamically Apply Default Tags to Auto Scaling Group

Coming soon!

Coming soon!

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetDefaultTagsArgs;
import com.pulumi.aws.autoscaling.Group;
import com.pulumi.aws.autoscaling.GroupArgs;
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 exampleDefaultTags = AwsFunctions.getDefaultTags();

        var exampleGroup = new Group("exampleGroup", GroupArgs.builder()        
            .dynamic(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
            .build());

    }
}

Coming soon!

Coming soon!

resources:
  exampleGroup:
    type: aws:autoscaling:Group
    properties:
      # ...
      dynamic:
        - forEach: ${exampleDefaultTags.tags}
          content:
            - key: ${tag.key}
              value: ${tag.value}
              propagateAtLaunch: true
variables:
  exampleDefaultTags:
    fn::invoke:
      Function: aws:getDefaultTags
      Arguments: {}

Using getDefaultTags

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getDefaultTags(args: GetDefaultTagsArgs, opts?: InvokeOptions): Promise<GetDefaultTagsResult>
function getDefaultTagsOutput(args: GetDefaultTagsOutputArgs, opts?: InvokeOptions): Output<GetDefaultTagsResult>
def get_default_tags(tags: Optional[Mapping[str, str]] = None,
                     opts: Optional[InvokeOptions] = None) -> GetDefaultTagsResult
def get_default_tags_output(tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetDefaultTagsResult]
func GetDefaultTags(ctx *Context, args *GetDefaultTagsArgs, opts ...InvokeOption) (*GetDefaultTagsResult, error)
func GetDefaultTagsOutput(ctx *Context, args *GetDefaultTagsOutputArgs, opts ...InvokeOption) GetDefaultTagsResultOutput

> Note: This function is named GetDefaultTags in the Go SDK.

public static class GetDefaultTags 
{
    public static Task<GetDefaultTagsResult> InvokeAsync(GetDefaultTagsArgs args, InvokeOptions? opts = null)
    public static Output<GetDefaultTagsResult> Invoke(GetDefaultTagsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDefaultTagsResult> getDefaultTags(GetDefaultTagsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: aws:index/getDefaultTags:getDefaultTags
  arguments:
    # arguments dictionary

The following arguments are supported:

Tags Dictionary<string, string>

Blocks of default tags set on the provider. See details below.

Tags map[string]string

Blocks of default tags set on the provider. See details below.

tags Map<String,String>

Blocks of default tags set on the provider. See details below.

tags {[key: string]: string}

Blocks of default tags set on the provider. See details below.

tags Mapping[str, str]

Blocks of default tags set on the provider. See details below.

tags Map<String>

Blocks of default tags set on the provider. See details below.

getDefaultTags Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Tags Dictionary<string, string>

Blocks of default tags set on the provider. See details below.

Id string

The provider-assigned unique ID for this managed resource.

Tags map[string]string

Blocks of default tags set on the provider. See details below.

id String

The provider-assigned unique ID for this managed resource.

tags Map<String,String>

Blocks of default tags set on the provider. See details below.

id string

The provider-assigned unique ID for this managed resource.

tags {[key: string]: string}

Blocks of default tags set on the provider. See details below.

id str

The provider-assigned unique ID for this managed resource.

tags Mapping[str, str]

Blocks of default tags set on the provider. See details below.

id String

The provider-assigned unique ID for this managed resource.

tags Map<String>

Blocks of default tags set on the provider. See details below.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.