1. Packages
  2. Pagerduty Provider
  3. API Docs
  4. UserContactMethod
PagerDuty v4.22.1 published on Friday, Mar 21, 2025 by Pulumi

pagerduty.UserContactMethod

Explore with Pulumi AI

Example Usage

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

const example = new pagerduty.User("example", {
    name: "Earline Greenholt",
    email: "125.greenholt.earline@graham.name",
    teams: [examplePagerdutyTeam.id],
});
const email = new pagerduty.UserContactMethod("email", {
    userId: example.id,
    type: "email_contact_method",
    address: "foo@bar.com",
    label: "Work",
});
const phone = new pagerduty.UserContactMethod("phone", {
    userId: example.id,
    type: "phone_contact_method",
    countryCode: 1,
    address: "2025550199",
    label: "Work",
});
const sms = new pagerduty.UserContactMethod("sms", {
    userId: example.id,
    type: "sms_contact_method",
    countryCode: 1,
    address: "2025550199",
    label: "Work",
});
Copy
import pulumi
import pulumi_pagerduty as pagerduty

example = pagerduty.User("example",
    name="Earline Greenholt",
    email="125.greenholt.earline@graham.name",
    teams=[example_pagerduty_team["id"]])
email = pagerduty.UserContactMethod("email",
    user_id=example.id,
    type="email_contact_method",
    address="foo@bar.com",
    label="Work")
phone = pagerduty.UserContactMethod("phone",
    user_id=example.id,
    type="phone_contact_method",
    country_code=1,
    address="2025550199",
    label="Work")
sms = pagerduty.UserContactMethod("sms",
    user_id=example.id,
    type="sms_contact_method",
    country_code=1,
    address="2025550199",
    label="Work")
Copy
package main

import (
	"github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := pagerduty.NewUser(ctx, "example", &pagerduty.UserArgs{
			Name:  pulumi.String("Earline Greenholt"),
			Email: pulumi.String("125.greenholt.earline@graham.name"),
			Teams: pulumi.StringArray{
				examplePagerdutyTeam.Id,
			},
		})
		if err != nil {
			return err
		}
		_, err = pagerduty.NewUserContactMethod(ctx, "email", &pagerduty.UserContactMethodArgs{
			UserId:  example.ID(),
			Type:    pulumi.String("email_contact_method"),
			Address: pulumi.String("foo@bar.com"),
			Label:   pulumi.String("Work"),
		})
		if err != nil {
			return err
		}
		_, err = pagerduty.NewUserContactMethod(ctx, "phone", &pagerduty.UserContactMethodArgs{
			UserId:      example.ID(),
			Type:        pulumi.String("phone_contact_method"),
			CountryCode: pulumi.Int(1),
			Address:     pulumi.String("2025550199"),
			Label:       pulumi.String("Work"),
		})
		if err != nil {
			return err
		}
		_, err = pagerduty.NewUserContactMethod(ctx, "sms", &pagerduty.UserContactMethodArgs{
			UserId:      example.ID(),
			Type:        pulumi.String("sms_contact_method"),
			CountryCode: pulumi.Int(1),
			Address:     pulumi.String("2025550199"),
			Label:       pulumi.String("Work"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Pagerduty = Pulumi.Pagerduty;

return await Deployment.RunAsync(() => 
{
    var example = new Pagerduty.User("example", new()
    {
        Name = "Earline Greenholt",
        Email = "125.greenholt.earline@graham.name",
        Teams = new[]
        {
            examplePagerdutyTeam.Id,
        },
    });

    var email = new Pagerduty.UserContactMethod("email", new()
    {
        UserId = example.Id,
        Type = "email_contact_method",
        Address = "foo@bar.com",
        Label = "Work",
    });

    var phone = new Pagerduty.UserContactMethod("phone", new()
    {
        UserId = example.Id,
        Type = "phone_contact_method",
        CountryCode = 1,
        Address = "2025550199",
        Label = "Work",
    });

    var sms = new Pagerduty.UserContactMethod("sms", new()
    {
        UserId = example.Id,
        Type = "sms_contact_method",
        CountryCode = 1,
        Address = "2025550199",
        Label = "Work",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.pagerduty.User;
import com.pulumi.pagerduty.UserArgs;
import com.pulumi.pagerduty.UserContactMethod;
import com.pulumi.pagerduty.UserContactMethodArgs;
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 example = new User("example", UserArgs.builder()
            .name("Earline Greenholt")
            .email("125.greenholt.earline@graham.name")
            .teams(examplePagerdutyTeam.id())
            .build());

        var email = new UserContactMethod("email", UserContactMethodArgs.builder()
            .userId(example.id())
            .type("email_contact_method")
            .address("foo@bar.com")
            .label("Work")
            .build());

        var phone = new UserContactMethod("phone", UserContactMethodArgs.builder()
            .userId(example.id())
            .type("phone_contact_method")
            .countryCode("+1")
            .address("2025550199")
            .label("Work")
            .build());

        var sms = new UserContactMethod("sms", UserContactMethodArgs.builder()
            .userId(example.id())
            .type("sms_contact_method")
            .countryCode("+1")
            .address("2025550199")
            .label("Work")
            .build());

    }
}
Copy
resources:
  example:
    type: pagerduty:User
    properties:
      name: Earline Greenholt
      email: 125.greenholt.earline@graham.name
      teams:
        - ${examplePagerdutyTeam.id}
  email:
    type: pagerduty:UserContactMethod
    properties:
      userId: ${example.id}
      type: email_contact_method
      address: foo@bar.com
      label: Work
  phone:
    type: pagerduty:UserContactMethod
    properties:
      userId: ${example.id}
      type: phone_contact_method
      countryCode: '+1'
      address: '2025550199'
      label: Work
  sms:
    type: pagerduty:UserContactMethod
    properties:
      userId: ${example.id}
      type: sms_contact_method
      countryCode: '+1'
      address: '2025550199'
      label: Work
Copy

Create UserContactMethod Resource

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

Constructor syntax

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

@overload
def UserContactMethod(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      address: Optional[str] = None,
                      label: Optional[str] = None,
                      type: Optional[str] = None,
                      user_id: Optional[str] = None,
                      country_code: Optional[int] = None,
                      send_short_email: Optional[bool] = None)
func NewUserContactMethod(ctx *Context, name string, args UserContactMethodArgs, opts ...ResourceOption) (*UserContactMethod, error)
public UserContactMethod(string name, UserContactMethodArgs args, CustomResourceOptions? opts = null)
public UserContactMethod(String name, UserContactMethodArgs args)
public UserContactMethod(String name, UserContactMethodArgs args, CustomResourceOptions options)
type: pagerduty:UserContactMethod
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. UserContactMethodArgs
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. UserContactMethodArgs
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. UserContactMethodArgs
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. UserContactMethodArgs
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. UserContactMethodArgs
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 userContactMethodResource = new Pagerduty.UserContactMethod("userContactMethodResource", new()
{
    Address = "string",
    Label = "string",
    Type = "string",
    UserId = "string",
    CountryCode = 0,
    SendShortEmail = false,
});
Copy
example, err := pagerduty.NewUserContactMethod(ctx, "userContactMethodResource", &pagerduty.UserContactMethodArgs{
	Address:        pulumi.String("string"),
	Label:          pulumi.String("string"),
	Type:           pulumi.String("string"),
	UserId:         pulumi.String("string"),
	CountryCode:    pulumi.Int(0),
	SendShortEmail: pulumi.Bool(false),
})
Copy
var userContactMethodResource = new UserContactMethod("userContactMethodResource", UserContactMethodArgs.builder()
    .address("string")
    .label("string")
    .type("string")
    .userId("string")
    .countryCode(0)
    .sendShortEmail(false)
    .build());
Copy
user_contact_method_resource = pagerduty.UserContactMethod("userContactMethodResource",
    address="string",
    label="string",
    type="string",
    user_id="string",
    country_code=0,
    send_short_email=False)
Copy
const userContactMethodResource = new pagerduty.UserContactMethod("userContactMethodResource", {
    address: "string",
    label: "string",
    type: "string",
    userId: "string",
    countryCode: 0,
    sendShortEmail: false,
});
Copy
type: pagerduty:UserContactMethod
properties:
    address: string
    countryCode: 0
    label: string
    sendShortEmail: false
    type: string
    userId: string
Copy

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

Address This property is required. string
The "address" to deliver to: email, phone number, etc., depending on the type.
Label This property is required. string
The label (e.g., "Work", "Mobile", etc.).
Type This property is required. string
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
UserId This property is required. string
The ID of the user.
CountryCode int
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
SendShortEmail bool
Send an abbreviated email message instead of the standard email output.
Address This property is required. string
The "address" to deliver to: email, phone number, etc., depending on the type.
Label This property is required. string
The label (e.g., "Work", "Mobile", etc.).
Type This property is required. string
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
UserId This property is required. string
The ID of the user.
CountryCode int
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
SendShortEmail bool
Send an abbreviated email message instead of the standard email output.
address This property is required. String
The "address" to deliver to: email, phone number, etc., depending on the type.
label This property is required. String
The label (e.g., "Work", "Mobile", etc.).
type This property is required. String
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
userId This property is required. String
The ID of the user.
countryCode Integer
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
sendShortEmail Boolean
Send an abbreviated email message instead of the standard email output.
address This property is required. string
The "address" to deliver to: email, phone number, etc., depending on the type.
label This property is required. string
The label (e.g., "Work", "Mobile", etc.).
type This property is required. string
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
userId This property is required. string
The ID of the user.
countryCode number
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
sendShortEmail boolean
Send an abbreviated email message instead of the standard email output.
address This property is required. str
The "address" to deliver to: email, phone number, etc., depending on the type.
label This property is required. str
The label (e.g., "Work", "Mobile", etc.).
type This property is required. str
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
user_id This property is required. str
The ID of the user.
country_code int
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
send_short_email bool
Send an abbreviated email message instead of the standard email output.
address This property is required. String
The "address" to deliver to: email, phone number, etc., depending on the type.
label This property is required. String
The label (e.g., "Work", "Mobile", etc.).
type This property is required. String
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
userId This property is required. String
The ID of the user.
countryCode Number
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
sendShortEmail Boolean
Send an abbreviated email message instead of the standard email output.

Outputs

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

Blacklisted bool
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
Enabled bool
If true, this phone is capable of receiving SMS messages.
Id string
The provider-assigned unique ID for this managed resource.
Blacklisted bool
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
Enabled bool
If true, this phone is capable of receiving SMS messages.
Id string
The provider-assigned unique ID for this managed resource.
blacklisted Boolean
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
enabled Boolean
If true, this phone is capable of receiving SMS messages.
id String
The provider-assigned unique ID for this managed resource.
blacklisted boolean
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
enabled boolean
If true, this phone is capable of receiving SMS messages.
id string
The provider-assigned unique ID for this managed resource.
blacklisted bool
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
enabled bool
If true, this phone is capable of receiving SMS messages.
id str
The provider-assigned unique ID for this managed resource.
blacklisted Boolean
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
enabled Boolean
If true, this phone is capable of receiving SMS messages.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing UserContactMethod Resource

Get an existing UserContactMethod 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?: UserContactMethodState, opts?: CustomResourceOptions): UserContactMethod
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        address: Optional[str] = None,
        blacklisted: Optional[bool] = None,
        country_code: Optional[int] = None,
        enabled: Optional[bool] = None,
        label: Optional[str] = None,
        send_short_email: Optional[bool] = None,
        type: Optional[str] = None,
        user_id: Optional[str] = None) -> UserContactMethod
func GetUserContactMethod(ctx *Context, name string, id IDInput, state *UserContactMethodState, opts ...ResourceOption) (*UserContactMethod, error)
public static UserContactMethod Get(string name, Input<string> id, UserContactMethodState? state, CustomResourceOptions? opts = null)
public static UserContactMethod get(String name, Output<String> id, UserContactMethodState state, CustomResourceOptions options)
resources:  _:    type: pagerduty:UserContactMethod    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:
Address string
The "address" to deliver to: email, phone number, etc., depending on the type.
Blacklisted bool
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
CountryCode int
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
Enabled bool
If true, this phone is capable of receiving SMS messages.
Label string
The label (e.g., "Work", "Mobile", etc.).
SendShortEmail bool
Send an abbreviated email message instead of the standard email output.
Type string
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
UserId string
The ID of the user.
Address string
The "address" to deliver to: email, phone number, etc., depending on the type.
Blacklisted bool
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
CountryCode int
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
Enabled bool
If true, this phone is capable of receiving SMS messages.
Label string
The label (e.g., "Work", "Mobile", etc.).
SendShortEmail bool
Send an abbreviated email message instead of the standard email output.
Type string
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
UserId string
The ID of the user.
address String
The "address" to deliver to: email, phone number, etc., depending on the type.
blacklisted Boolean
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
countryCode Integer
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
enabled Boolean
If true, this phone is capable of receiving SMS messages.
label String
The label (e.g., "Work", "Mobile", etc.).
sendShortEmail Boolean
Send an abbreviated email message instead of the standard email output.
type String
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
userId String
The ID of the user.
address string
The "address" to deliver to: email, phone number, etc., depending on the type.
blacklisted boolean
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
countryCode number
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
enabled boolean
If true, this phone is capable of receiving SMS messages.
label string
The label (e.g., "Work", "Mobile", etc.).
sendShortEmail boolean
Send an abbreviated email message instead of the standard email output.
type string
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
userId string
The ID of the user.
address str
The "address" to deliver to: email, phone number, etc., depending on the type.
blacklisted bool
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
country_code int
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
enabled bool
If true, this phone is capable of receiving SMS messages.
label str
The label (e.g., "Work", "Mobile", etc.).
send_short_email bool
Send an abbreviated email message instead of the standard email output.
type str
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
user_id str
The ID of the user.
address String
The "address" to deliver to: email, phone number, etc., depending on the type.
blacklisted Boolean
If true, this phone has been blacklisted by PagerDuty and no messages will be sent to it.
countryCode Number
The 1-to-3 digit country calling code. Required when using phone_contact_method or sms_contact_method.
enabled Boolean
If true, this phone is capable of receiving SMS messages.
label String
The label (e.g., "Work", "Mobile", etc.).
sendShortEmail Boolean
Send an abbreviated email message instead of the standard email output.
type String
The contact method type. May be (email_contact_method, phone_contact_method, sms_contact_method, push_notification_contact_method).
userId String
The ID of the user.

Import

Contact methods can be imported using the user_id and the id, e.g.

$ pulumi import pagerduty:index/userContactMethod:UserContactMethod main PLBP09X:PLBP09X
Copy

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

Package Details

Repository
PagerDuty pulumi/pulumi-pagerduty
License
Apache-2.0
Notes
This Pulumi package is based on the pagerduty Terraform Provider.