1. Packages
  2. Auth0
  3. API Docs
  4. ResourceServerScope
Auth0 v3.4.0 published on Wednesday, Jun 19, 2024 by Pulumi

auth0.ResourceServerScope

Explore with Pulumi AI

auth0 logo
Auth0 v3.4.0 published on Wednesday, Jun 19, 2024 by Pulumi

    With this resource, you can manage scopes (permissions) associated with a resource server (API).

    !> This resource appends a scope to a resource server. In contrast, the auth0.ResourceServerScopes resource manages all the scopes assigned to a resource server. To avoid potential issues, it is recommended not to use this resource in conjunction with the auth0.ResourceServerScopes resource when managing scopes for the same resource server id.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as auth0 from "@pulumi/auth0";
    
    const resourceServer = new auth0.ResourceServer("resource_server", {
        name: "Example Resource Server (Managed by Terraform)",
        identifier: "https://api.example.com",
    });
    const readPosts = new auth0.ResourceServerScope("read_posts", {
        resourceServerIdentifier: resourceServer.identifier,
        scope: "read:posts",
    });
    const writePosts = new auth0.ResourceServerScope("write_posts", {
        resourceServerIdentifier: resourceServer.identifier,
        scope: "write:posts",
    });
    
    import pulumi
    import pulumi_auth0 as auth0
    
    resource_server = auth0.ResourceServer("resource_server",
        name="Example Resource Server (Managed by Terraform)",
        identifier="https://api.example.com")
    read_posts = auth0.ResourceServerScope("read_posts",
        resource_server_identifier=resource_server.identifier,
        scope="read:posts")
    write_posts = auth0.ResourceServerScope("write_posts",
        resource_server_identifier=resource_server.identifier,
        scope="write:posts")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-auth0/sdk/v3/go/auth0"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		resourceServer, err := auth0.NewResourceServer(ctx, "resource_server", &auth0.ResourceServerArgs{
    			Name:       pulumi.String("Example Resource Server (Managed by Terraform)"),
    			Identifier: pulumi.String("https://api.example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = auth0.NewResourceServerScope(ctx, "read_posts", &auth0.ResourceServerScopeArgs{
    			ResourceServerIdentifier: resourceServer.Identifier,
    			Scope:                    pulumi.String("read:posts"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = auth0.NewResourceServerScope(ctx, "write_posts", &auth0.ResourceServerScopeArgs{
    			ResourceServerIdentifier: resourceServer.Identifier,
    			Scope:                    pulumi.String("write:posts"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Auth0 = Pulumi.Auth0;
    
    return await Deployment.RunAsync(() => 
    {
        var resourceServer = new Auth0.ResourceServer("resource_server", new()
        {
            Name = "Example Resource Server (Managed by Terraform)",
            Identifier = "https://api.example.com",
        });
    
        var readPosts = new Auth0.ResourceServerScope("read_posts", new()
        {
            ResourceServerIdentifier = resourceServer.Identifier,
            Scope = "read:posts",
        });
    
        var writePosts = new Auth0.ResourceServerScope("write_posts", new()
        {
            ResourceServerIdentifier = resourceServer.Identifier,
            Scope = "write:posts",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.auth0.ResourceServer;
    import com.pulumi.auth0.ResourceServerArgs;
    import com.pulumi.auth0.ResourceServerScope;
    import com.pulumi.auth0.ResourceServerScopeArgs;
    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 resourceServer = new ResourceServer("resourceServer", ResourceServerArgs.builder()
                .name("Example Resource Server (Managed by Terraform)")
                .identifier("https://api.example.com")
                .build());
    
            var readPosts = new ResourceServerScope("readPosts", ResourceServerScopeArgs.builder()
                .resourceServerIdentifier(resourceServer.identifier())
                .scope("read:posts")
                .build());
    
            var writePosts = new ResourceServerScope("writePosts", ResourceServerScopeArgs.builder()
                .resourceServerIdentifier(resourceServer.identifier())
                .scope("write:posts")
                .build());
    
        }
    }
    
    resources:
      resourceServer:
        type: auth0:ResourceServer
        name: resource_server
        properties:
          name: Example Resource Server (Managed by Terraform)
          identifier: https://api.example.com
      readPosts:
        type: auth0:ResourceServerScope
        name: read_posts
        properties:
          resourceServerIdentifier: ${resourceServer.identifier}
          scope: read:posts
      writePosts:
        type: auth0:ResourceServerScope
        name: write_posts
        properties:
          resourceServerIdentifier: ${resourceServer.identifier}
          scope: write:posts
    

    Create ResourceServerScope Resource

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

    Constructor syntax

    new ResourceServerScope(name: string, args: ResourceServerScopeArgs, opts?: CustomResourceOptions);
    @overload
    def ResourceServerScope(resource_name: str,
                            args: ResourceServerScopeArgs,
                            opts: Optional[ResourceOptions] = None)
    
    @overload
    def ResourceServerScope(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            resource_server_identifier: Optional[str] = None,
                            scope: Optional[str] = None,
                            description: Optional[str] = None)
    func NewResourceServerScope(ctx *Context, name string, args ResourceServerScopeArgs, opts ...ResourceOption) (*ResourceServerScope, error)
    public ResourceServerScope(string name, ResourceServerScopeArgs args, CustomResourceOptions? opts = null)
    public ResourceServerScope(String name, ResourceServerScopeArgs args)
    public ResourceServerScope(String name, ResourceServerScopeArgs args, CustomResourceOptions options)
    
    type: auth0:ResourceServerScope
    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 ResourceServerScopeArgs
    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 ResourceServerScopeArgs
    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 ResourceServerScopeArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourceServerScopeArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourceServerScopeArgs
    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 resourceServerScopeResource = new Auth0.ResourceServerScope("resourceServerScopeResource", new()
    {
        ResourceServerIdentifier = "string",
        Scope = "string",
        Description = "string",
    });
    
    example, err := auth0.NewResourceServerScope(ctx, "resourceServerScopeResource", &auth0.ResourceServerScopeArgs{
    	ResourceServerIdentifier: pulumi.String("string"),
    	Scope:                    pulumi.String("string"),
    	Description:              pulumi.String("string"),
    })
    
    var resourceServerScopeResource = new ResourceServerScope("resourceServerScopeResource", ResourceServerScopeArgs.builder()
        .resourceServerIdentifier("string")
        .scope("string")
        .description("string")
        .build());
    
    resource_server_scope_resource = auth0.ResourceServerScope("resourceServerScopeResource",
        resource_server_identifier="string",
        scope="string",
        description="string")
    
    const resourceServerScopeResource = new auth0.ResourceServerScope("resourceServerScopeResource", {
        resourceServerIdentifier: "string",
        scope: "string",
        description: "string",
    });
    
    type: auth0:ResourceServerScope
    properties:
        description: string
        resourceServerIdentifier: string
        scope: string
    

    ResourceServerScope Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ResourceServerScope resource accepts the following input properties:

    ResourceServerIdentifier string
    Identifier of the resource server that the scope (permission) is associated with.
    Scope string
    Name of the scope (permission).
    Description string
    Description of the scope (permission).
    ResourceServerIdentifier string
    Identifier of the resource server that the scope (permission) is associated with.
    Scope string
    Name of the scope (permission).
    Description string
    Description of the scope (permission).
    resourceServerIdentifier String
    Identifier of the resource server that the scope (permission) is associated with.
    scope String
    Name of the scope (permission).
    description String
    Description of the scope (permission).
    resourceServerIdentifier string
    Identifier of the resource server that the scope (permission) is associated with.
    scope string
    Name of the scope (permission).
    description string
    Description of the scope (permission).
    resource_server_identifier str
    Identifier of the resource server that the scope (permission) is associated with.
    scope str
    Name of the scope (permission).
    description str
    Description of the scope (permission).
    resourceServerIdentifier String
    Identifier of the resource server that the scope (permission) is associated with.
    scope String
    Name of the scope (permission).
    description String
    Description of the scope (permission).

    Outputs

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

    Get an existing ResourceServerScope 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?: ResourceServerScopeState, opts?: CustomResourceOptions): ResourceServerScope
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            resource_server_identifier: Optional[str] = None,
            scope: Optional[str] = None) -> ResourceServerScope
    func GetResourceServerScope(ctx *Context, name string, id IDInput, state *ResourceServerScopeState, opts ...ResourceOption) (*ResourceServerScope, error)
    public static ResourceServerScope Get(string name, Input<string> id, ResourceServerScopeState? state, CustomResourceOptions? opts = null)
    public static ResourceServerScope get(String name, Output<String> id, ResourceServerScopeState 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:
    Description string
    Description of the scope (permission).
    ResourceServerIdentifier string
    Identifier of the resource server that the scope (permission) is associated with.
    Scope string
    Name of the scope (permission).
    Description string
    Description of the scope (permission).
    ResourceServerIdentifier string
    Identifier of the resource server that the scope (permission) is associated with.
    Scope string
    Name of the scope (permission).
    description String
    Description of the scope (permission).
    resourceServerIdentifier String
    Identifier of the resource server that the scope (permission) is associated with.
    scope String
    Name of the scope (permission).
    description string
    Description of the scope (permission).
    resourceServerIdentifier string
    Identifier of the resource server that the scope (permission) is associated with.
    scope string
    Name of the scope (permission).
    description str
    Description of the scope (permission).
    resource_server_identifier str
    Identifier of the resource server that the scope (permission) is associated with.
    scope str
    Name of the scope (permission).
    description String
    Description of the scope (permission).
    resourceServerIdentifier String
    Identifier of the resource server that the scope (permission) is associated with.
    scope String
    Name of the scope (permission).

    Import

    This resource can be imported by specifying the

    resource identifier and scope name separated by “::” (note the double colon)

    ::

    Example:

    $ pulumi import auth0:index/resourceServerScope:ResourceServerScope scope "https://api.travel0.com/v1::read:posts"
    

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

    Package Details

    Repository
    Auth0 pulumi/pulumi-auth0
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the auth0 Terraform Provider.
    auth0 logo
    Auth0 v3.4.0 published on Wednesday, Jun 19, 2024 by Pulumi