1. Packages
  2. Newrelic Provider
  3. API Docs
  4. cloud
  5. GcpLinkAccount
New Relic v5.44.1 published on Tuesday, Apr 15, 2025 by Pulumi

newrelic.cloud.GcpLinkAccount

Explore with Pulumi AI

Use this resource to link a GCP account to New Relic.

Prerequisite

To start receiving Google Cloud Platform (GCP) data with New Relic GCP integrations, connect your Google project to New Relic infrastructure monitoring. If you don’t have one already, create a New Relic account. It’s free, forever.

Setup is required in GCP for this resource to work properly. The New Relic GCP integration can be done by creating a user account or a service account.

A user with Project IAM Admin role is needed to add the service account ID as a member in your GCP project.

In the GCP project IAM & admin, the service account must have the Project Viewer role and the Service Usage Consumer role or, alternatively, a custom role.

Follow the steps outlined here to set up the integration.

Example Usage

You can also use the full example, including the GCP set up, found in our guides.

import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";

const foo = new newrelic.cloud.GcpLinkAccount("foo", {
    accountId: "account id of newrelic account",
    projectId: "id of the Project",
    name: "account name",
});
Copy
import pulumi
import pulumi_newrelic as newrelic

foo = newrelic.cloud.GcpLinkAccount("foo",
    account_id="account id of newrelic account",
    project_id="id of the Project",
    name="account name")
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloud.NewGcpLinkAccount(ctx, "foo", &cloud.GcpLinkAccountArgs{
			AccountId: pulumi.String("account id of newrelic account"),
			ProjectId: pulumi.String("id of the Project"),
			Name:      pulumi.String("account name"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using NewRelic = Pulumi.NewRelic;

return await Deployment.RunAsync(() => 
{
    var foo = new NewRelic.Cloud.GcpLinkAccount("foo", new()
    {
        AccountId = "account id of newrelic account",
        ProjectId = "id of the Project",
        Name = "account name",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.cloud.GcpLinkAccount;
import com.pulumi.newrelic.cloud.GcpLinkAccountArgs;
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) {
        var foo = new GcpLinkAccount("foo", GcpLinkAccountArgs.builder()
            .accountId("account id of newrelic account")
            .projectId("id of the Project")
            .name("account name")
            .build());

    }
}
Copy
resources:
  foo:
    type: newrelic:cloud:GcpLinkAccount
    properties:
      accountId: account id of newrelic account
      projectId: id of the Project
      name: account name
Copy

Create GcpLinkAccount Resource

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

Constructor syntax

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

@overload
def GcpLinkAccount(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   project_id: Optional[str] = None,
                   account_id: Optional[str] = None,
                   name: Optional[str] = None)
func NewGcpLinkAccount(ctx *Context, name string, args GcpLinkAccountArgs, opts ...ResourceOption) (*GcpLinkAccount, error)
public GcpLinkAccount(string name, GcpLinkAccountArgs args, CustomResourceOptions? opts = null)
public GcpLinkAccount(String name, GcpLinkAccountArgs args)
public GcpLinkAccount(String name, GcpLinkAccountArgs args, CustomResourceOptions options)
type: newrelic:cloud:GcpLinkAccount
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. GcpLinkAccountArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. GcpLinkAccountArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. GcpLinkAccountArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. GcpLinkAccountArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. GcpLinkAccountArgs
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 gcpLinkAccountResource = new NewRelic.Cloud.GcpLinkAccount("gcpLinkAccountResource", new()
{
    ProjectId = "string",
    AccountId = "string",
    Name = "string",
});
Copy
example, err := cloud.NewGcpLinkAccount(ctx, "gcpLinkAccountResource", &cloud.GcpLinkAccountArgs{
	ProjectId: pulumi.String("string"),
	AccountId: pulumi.String("string"),
	Name:      pulumi.String("string"),
})
Copy
var gcpLinkAccountResource = new GcpLinkAccount("gcpLinkAccountResource", GcpLinkAccountArgs.builder()
    .projectId("string")
    .accountId("string")
    .name("string")
    .build());
Copy
gcp_link_account_resource = newrelic.cloud.GcpLinkAccount("gcpLinkAccountResource",
    project_id="string",
    account_id="string",
    name="string")
Copy
const gcpLinkAccountResource = new newrelic.cloud.GcpLinkAccount("gcpLinkAccountResource", {
    projectId: "string",
    accountId: "string",
    name: "string",
});
Copy
type: newrelic:cloud:GcpLinkAccount
properties:
    accountId: string
    name: string
    projectId: string
Copy

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

ProjectId
This property is required.
Changes to this property will trigger replacement.
string
Project ID of the GCP account.
AccountId Changes to this property will trigger replacement. string
Account ID of the New Relic account.
Name string
name of the linked account
ProjectId
This property is required.
Changes to this property will trigger replacement.
string
Project ID of the GCP account.
AccountId Changes to this property will trigger replacement. string
Account ID of the New Relic account.
Name string
name of the linked account
projectId
This property is required.
Changes to this property will trigger replacement.
String
Project ID of the GCP account.
accountId Changes to this property will trigger replacement. String
Account ID of the New Relic account.
name String
name of the linked account
projectId
This property is required.
Changes to this property will trigger replacement.
string
Project ID of the GCP account.
accountId Changes to this property will trigger replacement. string
Account ID of the New Relic account.
name string
name of the linked account
project_id
This property is required.
Changes to this property will trigger replacement.
str
Project ID of the GCP account.
account_id Changes to this property will trigger replacement. str
Account ID of the New Relic account.
name str
name of the linked account
projectId
This property is required.
Changes to this property will trigger replacement.
String
Project ID of the GCP account.
accountId Changes to this property will trigger replacement. String
Account ID of the New Relic account.
name String
name of the linked account

Outputs

All input properties are implicitly available as output properties. Additionally, the GcpLinkAccount 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 GcpLinkAccount Resource

Get an existing GcpLinkAccount 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?: GcpLinkAccountState, opts?: CustomResourceOptions): GcpLinkAccount
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        name: Optional[str] = None,
        project_id: Optional[str] = None) -> GcpLinkAccount
func GetGcpLinkAccount(ctx *Context, name string, id IDInput, state *GcpLinkAccountState, opts ...ResourceOption) (*GcpLinkAccount, error)
public static GcpLinkAccount Get(string name, Input<string> id, GcpLinkAccountState? state, CustomResourceOptions? opts = null)
public static GcpLinkAccount get(String name, Output<String> id, GcpLinkAccountState state, CustomResourceOptions options)
resources:  _:    type: newrelic:cloud:GcpLinkAccount    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AccountId Changes to this property will trigger replacement. string
Account ID of the New Relic account.
Name string
name of the linked account
ProjectId Changes to this property will trigger replacement. string
Project ID of the GCP account.
AccountId Changes to this property will trigger replacement. string
Account ID of the New Relic account.
Name string
name of the linked account
ProjectId Changes to this property will trigger replacement. string
Project ID of the GCP account.
accountId Changes to this property will trigger replacement. String
Account ID of the New Relic account.
name String
name of the linked account
projectId Changes to this property will trigger replacement. String
Project ID of the GCP account.
accountId Changes to this property will trigger replacement. string
Account ID of the New Relic account.
name string
name of the linked account
projectId Changes to this property will trigger replacement. string
Project ID of the GCP account.
account_id Changes to this property will trigger replacement. str
Account ID of the New Relic account.
name str
name of the linked account
project_id Changes to this property will trigger replacement. str
Project ID of the GCP account.
accountId Changes to this property will trigger replacement. String
Account ID of the New Relic account.
name String
name of the linked account
projectId Changes to this property will trigger replacement. String
Project ID of the GCP account.

Import

Linked GCP accounts can be imported using id, you can find the id of an existing GCP linked accounts in GCP dashboard under Infrastructure in Newrelic Console.

bash

$ pulumi import newrelic:cloud/gcpLinkAccount:GcpLinkAccount  newrelic_cloud_gcp_link_account.foo <id>
Copy

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.