1. Packages
  2. AWS Classic
  3. API Docs
  4. getDefaultTags

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.getDefaultTags

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    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

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.getDefaultTags({});
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.get_default_tags()
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.GetDefaultTags.Invoke();
    
    });
    
    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();
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:getDefaultTags
          Arguments: {}
    

    Dynamically Apply Default Tags to Auto Scaling Group

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.getDefaultTags({});
    const exampleGroup = new aws.autoscaling.Group("example", {tags: .map(entry => ({
        key: entry.key,
        value: entry.value,
        propagateAtLaunch: true,
    }))});
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.get_default_tags()
    example_group = aws.autoscaling.Group("example", tags=[{
        "key": entry["key"],
        "value": entry["value"],
        "propagateAtLaunch": True,
    } for entry in [{"key": k, "value": v} for k, v in example.tags]])
    
    Coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.GetDefaultTags.Invoke();
    
        var exampleGroup = new Aws.AutoScaling.Group("example", new()
        {
            Tags = ,
        });
    
    });
    
    Coming soon!
    
    Coming soon!
    

    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(id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetDefaultTagsResult
    def get_default_tags_output(id: Optional[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:

    Id string
    Id string
    id String
    id string
    id str
    id String

    getDefaultTags Result

    The following output properties are available:

    Id string
    Tags Dictionary<string, string>
    Key-value mapping of provider default tags.
    Id string
    Tags map[string]string
    Key-value mapping of provider default tags.
    id String
    tags Map<String,String>
    Key-value mapping of provider default tags.
    id string
    tags {[key: string]: string}
    Key-value mapping of provider default tags.
    id str
    tags Mapping[str, str]
    Key-value mapping of provider default tags.
    id String
    tags Map<String>
    Key-value mapping of provider default tags.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi