1. Packages
  2. New Relic
  3. API Docs
  4. EntityTags
New Relic v5.36.1 published on Tuesday, Nov 12, 2024 by Pulumi

newrelic.EntityTags

Explore with Pulumi AI

newrelic logo
New Relic v5.36.1 published on Tuesday, Nov 12, 2024 by Pulumi

    Use this resource to create, update, and delete tags for a New Relic One entity.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const foo = newrelic.getEntity({
        name: "Example application",
        type: "APPLICATION",
        domain: "APM",
    });
    const fooEntityTags = new newrelic.EntityTags("foo", {
        guid: foo.then(foo => foo.guid),
        tags: [
            {
                key: "my-key",
                values: [
                    "my-value",
                    "my-other-value",
                ],
            },
            {
                key: "my-key-2",
                values: ["my-value-2"],
            },
        ],
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    foo = newrelic.get_entity(name="Example application",
        type="APPLICATION",
        domain="APM")
    foo_entity_tags = newrelic.EntityTags("foo",
        guid=foo.guid,
        tags=[
            {
                "key": "my-key",
                "values": [
                    "my-value",
                    "my-other-value",
                ],
            },
            {
                "key": "my-key-2",
                "values": ["my-value-2"],
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		foo, err := newrelic.GetEntity(ctx, &newrelic.GetEntityArgs{
    			Name:   "Example application",
    			Type:   pulumi.StringRef("APPLICATION"),
    			Domain: pulumi.StringRef("APM"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.NewEntityTags(ctx, "foo", &newrelic.EntityTagsArgs{
    			Guid: pulumi.String(foo.Guid),
    			Tags: newrelic.EntityTagsTagArray{
    				&newrelic.EntityTagsTagArgs{
    					Key: pulumi.String("my-key"),
    					Values: pulumi.StringArray{
    						pulumi.String("my-value"),
    						pulumi.String("my-other-value"),
    					},
    				},
    				&newrelic.EntityTagsTagArgs{
    					Key: pulumi.String("my-key-2"),
    					Values: pulumi.StringArray{
    						pulumi.String("my-value-2"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = NewRelic.GetEntity.Invoke(new()
        {
            Name = "Example application",
            Type = "APPLICATION",
            Domain = "APM",
        });
    
        var fooEntityTags = new NewRelic.EntityTags("foo", new()
        {
            Guid = foo.Apply(getEntityResult => getEntityResult.Guid),
            Tags = new[]
            {
                new NewRelic.Inputs.EntityTagsTagArgs
                {
                    Key = "my-key",
                    Values = new[]
                    {
                        "my-value",
                        "my-other-value",
                    },
                },
                new NewRelic.Inputs.EntityTagsTagArgs
                {
                    Key = "my-key-2",
                    Values = new[]
                    {
                        "my-value-2",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NewrelicFunctions;
    import com.pulumi.newrelic.inputs.GetEntityArgs;
    import com.pulumi.newrelic.EntityTags;
    import com.pulumi.newrelic.EntityTagsArgs;
    import com.pulumi.newrelic.inputs.EntityTagsTagArgs;
    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 foo = NewrelicFunctions.getEntity(GetEntityArgs.builder()
                .name("Example application")
                .type("APPLICATION")
                .domain("APM")
                .build());
    
            var fooEntityTags = new EntityTags("fooEntityTags", EntityTagsArgs.builder()
                .guid(foo.applyValue(getEntityResult -> getEntityResult.guid()))
                .tags(            
                    EntityTagsTagArgs.builder()
                        .key("my-key")
                        .values(                    
                            "my-value",
                            "my-other-value")
                        .build(),
                    EntityTagsTagArgs.builder()
                        .key("my-key-2")
                        .values("my-value-2")
                        .build())
                .build());
    
        }
    }
    
    resources:
      fooEntityTags:
        type: newrelic:EntityTags
        name: foo
        properties:
          guid: ${foo.guid}
          tags:
            - key: my-key
              values:
                - my-value
                - my-other-value
            - key: my-key-2
              values:
                - my-value-2
    variables:
      foo:
        fn::invoke:
          Function: newrelic:getEntity
          Arguments:
            name: Example application
            type: APPLICATION
            domain: APM
    

    Create EntityTags Resource

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

    Constructor syntax

    new EntityTags(name: string, args: EntityTagsArgs, opts?: CustomResourceOptions);
    @overload
    def EntityTags(resource_name: str,
                   args: EntityTagsArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def EntityTags(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   guid: Optional[str] = None,
                   tags: Optional[Sequence[EntityTagsTagArgs]] = None)
    func NewEntityTags(ctx *Context, name string, args EntityTagsArgs, opts ...ResourceOption) (*EntityTags, error)
    public EntityTags(string name, EntityTagsArgs args, CustomResourceOptions? opts = null)
    public EntityTags(String name, EntityTagsArgs args)
    public EntityTags(String name, EntityTagsArgs args, CustomResourceOptions options)
    
    type: newrelic:EntityTags
    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 EntityTagsArgs
    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 EntityTagsArgs
    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 EntityTagsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EntityTagsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EntityTagsArgs
    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 entityTagsResource = new NewRelic.EntityTags("entityTagsResource", new()
    {
        Guid = "string",
        Tags = new[]
        {
            new NewRelic.Inputs.EntityTagsTagArgs
            {
                Key = "string",
                Values = new[]
                {
                    "string",
                },
            },
        },
    });
    
    example, err := newrelic.NewEntityTags(ctx, "entityTagsResource", &newrelic.EntityTagsArgs{
    	Guid: pulumi.String("string"),
    	Tags: newrelic.EntityTagsTagArray{
    		&newrelic.EntityTagsTagArgs{
    			Key: pulumi.String("string"),
    			Values: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    		},
    	},
    })
    
    var entityTagsResource = new EntityTags("entityTagsResource", EntityTagsArgs.builder()
        .guid("string")
        .tags(EntityTagsTagArgs.builder()
            .key("string")
            .values("string")
            .build())
        .build());
    
    entity_tags_resource = newrelic.EntityTags("entityTagsResource",
        guid="string",
        tags=[{
            "key": "string",
            "values": ["string"],
        }])
    
    const entityTagsResource = new newrelic.EntityTags("entityTagsResource", {
        guid: "string",
        tags: [{
            key: "string",
            values: ["string"],
        }],
    });
    
    type: newrelic:EntityTags
    properties:
        guid: string
        tags:
            - key: string
              values:
                - string
    

    EntityTags 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 EntityTags resource accepts the following input properties:

    Guid string
    The guid of the entity to tag.
    Tags List<Pulumi.NewRelic.Inputs.EntityTagsTag>
    A nested block that describes an entity tag. See Nested tag blocks below for details.
    Guid string
    The guid of the entity to tag.
    Tags []EntityTagsTagArgs
    A nested block that describes an entity tag. See Nested tag blocks below for details.
    guid String
    The guid of the entity to tag.
    tags List<EntityTagsTag>
    A nested block that describes an entity tag. See Nested tag blocks below for details.
    guid string
    The guid of the entity to tag.
    tags EntityTagsTag[]
    A nested block that describes an entity tag. See Nested tag blocks below for details.
    guid str
    The guid of the entity to tag.
    tags Sequence[EntityTagsTagArgs]
    A nested block that describes an entity tag. See Nested tag blocks below for details.
    guid String
    The guid of the entity to tag.
    tags List<Property Map>
    A nested block that describes an entity tag. See Nested tag blocks below for details.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing EntityTags Resource

    Get an existing EntityTags resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: EntityTagsState, opts?: CustomResourceOptions): EntityTags
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            guid: Optional[str] = None,
            tags: Optional[Sequence[EntityTagsTagArgs]] = None) -> EntityTags
    func GetEntityTags(ctx *Context, name string, id IDInput, state *EntityTagsState, opts ...ResourceOption) (*EntityTags, error)
    public static EntityTags Get(string name, Input<string> id, EntityTagsState? state, CustomResourceOptions? opts = null)
    public static EntityTags get(String name, Output<String> id, EntityTagsState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Guid string
    The guid of the entity to tag.
    Tags List<Pulumi.NewRelic.Inputs.EntityTagsTag>
    A nested block that describes an entity tag. See Nested tag blocks below for details.
    Guid string
    The guid of the entity to tag.
    Tags []EntityTagsTagArgs
    A nested block that describes an entity tag. See Nested tag blocks below for details.
    guid String
    The guid of the entity to tag.
    tags List<EntityTagsTag>
    A nested block that describes an entity tag. See Nested tag blocks below for details.
    guid string
    The guid of the entity to tag.
    tags EntityTagsTag[]
    A nested block that describes an entity tag. See Nested tag blocks below for details.
    guid str
    The guid of the entity to tag.
    tags Sequence[EntityTagsTagArgs]
    A nested block that describes an entity tag. See Nested tag blocks below for details.
    guid String
    The guid of the entity to tag.
    tags List<Property Map>
    A nested block that describes an entity tag. See Nested tag blocks below for details.

    Supporting Types

    EntityTagsTag, EntityTagsTagArgs

    Key string

    The key of the tag.

    NOTE: One should not use reserved (immutable) keys with this resource. It is recommended to choose unique and descriptive keys which do not conflict with existing reserved keys.

    Values List<string>
    The tag values.
    Key string

    The key of the tag.

    NOTE: One should not use reserved (immutable) keys with this resource. It is recommended to choose unique and descriptive keys which do not conflict with existing reserved keys.

    Values []string
    The tag values.
    key String

    The key of the tag.

    NOTE: One should not use reserved (immutable) keys with this resource. It is recommended to choose unique and descriptive keys which do not conflict with existing reserved keys.

    values List<String>
    The tag values.
    key string

    The key of the tag.

    NOTE: One should not use reserved (immutable) keys with this resource. It is recommended to choose unique and descriptive keys which do not conflict with existing reserved keys.

    values string[]
    The tag values.
    key str

    The key of the tag.

    NOTE: One should not use reserved (immutable) keys with this resource. It is recommended to choose unique and descriptive keys which do not conflict with existing reserved keys.

    values Sequence[str]
    The tag values.
    key String

    The key of the tag.

    NOTE: One should not use reserved (immutable) keys with this resource. It is recommended to choose unique and descriptive keys which do not conflict with existing reserved keys.

    values List<String>
    The tag values.

    Import

    New Relic One entity tags can be imported using a concatenated string of the format

    <guid>, e.g.

    bash

    $ pulumi import newrelic:index/entityTags:EntityTags foo MjUyMDUyOHxBUE18QVBRTElDQVRJT058MjE1MDM3Nzk1
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    New Relic pulumi/pulumi-newrelic
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the newrelic Terraform Provider.
    newrelic logo
    New Relic v5.36.1 published on Tuesday, Nov 12, 2024 by Pulumi