1. Packages
  2. Fastly Provider
  3. API Docs
  4. ServiceAuthorization
Fastly v8.14.0 published on Monday, Feb 3, 2025 by Pulumi

fastly.ServiceAuthorization

Explore with Pulumi AI

Configures authorization with granular permissions to services. Users can be granted rights for services on different levels.

The Service Authorization resource requires a user id, service id and an optional permission.

Example Usage

Basic usage:

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

const demo = new fastly.ServiceVcl("demo", {});
const user = new fastly.User("user", {});
const auth = new fastly.ServiceAuthorization("auth", {
    serviceId: demo.id,
    userId: user.id,
    permission: "purge_all",
});
Copy
import pulumi
import pulumi_fastly as fastly

demo = fastly.ServiceVcl("demo")
user = fastly.User("user")
auth = fastly.ServiceAuthorization("auth",
    service_id=demo.id,
    user_id=user.id,
    permission="purge_all")
Copy
package main

import (
	"github.com/pulumi/pulumi-fastly/sdk/v8/go/fastly"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		demo, err := fastly.NewServiceVcl(ctx, "demo", nil)
		if err != nil {
			return err
		}
		user, err := fastly.NewUser(ctx, "user", nil)
		if err != nil {
			return err
		}
		_, err = fastly.NewServiceAuthorization(ctx, "auth", &fastly.ServiceAuthorizationArgs{
			ServiceId:  demo.ID(),
			UserId:     user.ID(),
			Permission: pulumi.String("purge_all"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Fastly = Pulumi.Fastly;

return await Deployment.RunAsync(() => 
{
    var demo = new Fastly.ServiceVcl("demo");

    var user = new Fastly.User("user");

    var auth = new Fastly.ServiceAuthorization("auth", new()
    {
        ServiceId = demo.Id,
        UserId = user.Id,
        Permission = "purge_all",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.fastly.ServiceVcl;
import com.pulumi.fastly.User;
import com.pulumi.fastly.ServiceAuthorization;
import com.pulumi.fastly.ServiceAuthorizationArgs;
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 demo = new ServiceVcl("demo");

        var user = new User("user");

        var auth = new ServiceAuthorization("auth", ServiceAuthorizationArgs.builder()
            .serviceId(demo.id())
            .userId(user.id())
            .permission("purge_all")
            .build());

    }
}
Copy
resources:
  demo:
    type: fastly:ServiceVcl
  user:
    type: fastly:User
  auth:
    type: fastly:ServiceAuthorization
    properties:
      serviceId: ${demo.id}
      userId: ${user.id}
      permission: purge_all
Copy

Create ServiceAuthorization Resource

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

Constructor syntax

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

@overload
def ServiceAuthorization(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         permission: Optional[str] = None,
                         service_id: Optional[str] = None,
                         user_id: Optional[str] = None)
func NewServiceAuthorization(ctx *Context, name string, args ServiceAuthorizationArgs, opts ...ResourceOption) (*ServiceAuthorization, error)
public ServiceAuthorization(string name, ServiceAuthorizationArgs args, CustomResourceOptions? opts = null)
public ServiceAuthorization(String name, ServiceAuthorizationArgs args)
public ServiceAuthorization(String name, ServiceAuthorizationArgs args, CustomResourceOptions options)
type: fastly:ServiceAuthorization
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. ServiceAuthorizationArgs
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. ServiceAuthorizationArgs
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. ServiceAuthorizationArgs
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. ServiceAuthorizationArgs
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. ServiceAuthorizationArgs
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 serviceAuthorizationResource = new Fastly.ServiceAuthorization("serviceAuthorizationResource", new()
{
    Permission = "string",
    ServiceId = "string",
    UserId = "string",
});
Copy
example, err := fastly.NewServiceAuthorization(ctx, "serviceAuthorizationResource", &fastly.ServiceAuthorizationArgs{
	Permission: pulumi.String("string"),
	ServiceId:  pulumi.String("string"),
	UserId:     pulumi.String("string"),
})
Copy
var serviceAuthorizationResource = new ServiceAuthorization("serviceAuthorizationResource", ServiceAuthorizationArgs.builder()
    .permission("string")
    .serviceId("string")
    .userId("string")
    .build());
Copy
service_authorization_resource = fastly.ServiceAuthorization("serviceAuthorizationResource",
    permission="string",
    service_id="string",
    user_id="string")
Copy
const serviceAuthorizationResource = new fastly.ServiceAuthorization("serviceAuthorizationResource", {
    permission: "string",
    serviceId: "string",
    userId: "string",
});
Copy
type: fastly:ServiceAuthorization
properties:
    permission: string
    serviceId: string
    userId: string
Copy

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

Permission This property is required. string
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
ServiceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the service to grant permissions for.
UserId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the user which will receive the granted permissions.
Permission This property is required. string
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
ServiceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the service to grant permissions for.
UserId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the user which will receive the granted permissions.
permission This property is required. String
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
serviceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the service to grant permissions for.
userId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the user which will receive the granted permissions.
permission This property is required. string
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
serviceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the service to grant permissions for.
userId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the user which will receive the granted permissions.
permission This property is required. str
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
service_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the service to grant permissions for.
user_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the user which will receive the granted permissions.
permission This property is required. String
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
serviceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the service to grant permissions for.
userId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the user which will receive the granted permissions.

Outputs

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

Get an existing ServiceAuthorization 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?: ServiceAuthorizationState, opts?: CustomResourceOptions): ServiceAuthorization
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        permission: Optional[str] = None,
        service_id: Optional[str] = None,
        user_id: Optional[str] = None) -> ServiceAuthorization
func GetServiceAuthorization(ctx *Context, name string, id IDInput, state *ServiceAuthorizationState, opts ...ResourceOption) (*ServiceAuthorization, error)
public static ServiceAuthorization Get(string name, Input<string> id, ServiceAuthorizationState? state, CustomResourceOptions? opts = null)
public static ServiceAuthorization get(String name, Output<String> id, ServiceAuthorizationState state, CustomResourceOptions options)
resources:  _:    type: fastly:ServiceAuthorization    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:
Permission string
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
ServiceId Changes to this property will trigger replacement. string
The ID of the service to grant permissions for.
UserId Changes to this property will trigger replacement. string
The ID of the user which will receive the granted permissions.
Permission string
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
ServiceId Changes to this property will trigger replacement. string
The ID of the service to grant permissions for.
UserId Changes to this property will trigger replacement. string
The ID of the user which will receive the granted permissions.
permission String
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
serviceId Changes to this property will trigger replacement. String
The ID of the service to grant permissions for.
userId Changes to this property will trigger replacement. String
The ID of the user which will receive the granted permissions.
permission string
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
serviceId Changes to this property will trigger replacement. string
The ID of the service to grant permissions for.
userId Changes to this property will trigger replacement. string
The ID of the user which will receive the granted permissions.
permission str
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
service_id Changes to this property will trigger replacement. str
The ID of the service to grant permissions for.
user_id Changes to this property will trigger replacement. str
The ID of the user which will receive the granted permissions.
permission String
The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
serviceId Changes to this property will trigger replacement. String
The ID of the service to grant permissions for.
userId Changes to this property will trigger replacement. String
The ID of the user which will receive the granted permissions.

Import

A Fastly Service Authorization can be imported using their user ID, e.g.

$ pulumi import fastly:index/serviceAuthorization:ServiceAuthorization demo xxxxxxxxxxxxxxxxxxxx
Copy

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

Package Details

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