artifactory.AccessToken
Explore with Pulumi AI
!> Warning: This resource is being deprecated and replaced by artifactory.ScopedToken
since v6.8.0.
Provides an Artifactory Access Token resource. This can be used to create and manage Artifactory Access Tokens.
Note: Access Tokens will be stored in the raw state as plain-text. Read more about sensitive data in state.
Example Usage
S
Create a new Artifactory Access Token for an existing user
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const exisingUser = new artifactory.AccessToken("exising_user", {
username: "existing-user",
endDateRelative: "5m",
});
import pulumi
import pulumi_artifactory as artifactory
exising_user = artifactory.AccessToken("exising_user",
username="existing-user",
end_date_relative="5m")
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := artifactory.NewAccessToken(ctx, "exising_user", &artifactory.AccessTokenArgs{
Username: pulumi.String("existing-user"),
EndDateRelative: pulumi.String("5m"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var exisingUser = new Artifactory.AccessToken("exising_user", new()
{
Username = "existing-user",
EndDateRelative = "5m",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.AccessToken;
import com.pulumi.artifactory.AccessTokenArgs;
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 exisingUser = new AccessToken("exisingUser", AccessTokenArgs.builder()
.username("existing-user")
.endDateRelative("5m")
.build());
}
}
resources:
exisingUser:
type: artifactory:AccessToken
name: exising_user
properties:
username: existing-user
endDateRelative: 5m
Note: This assumes that the user existing-user
has already been created in Artifactory by different means, i.e. manually or in a separate pulumi up.
Create a new Artifactory User and Access token
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const newUser = new artifactory.User("new_user", {
name: "new_user",
email: "new_user@somewhere.com",
groups: ["readers"],
});
const newUserAccessToken = new artifactory.AccessToken("new_user", {
username: newUser.name,
endDateRelative: "5m",
});
import pulumi
import pulumi_artifactory as artifactory
new_user = artifactory.User("new_user",
name="new_user",
email="new_user@somewhere.com",
groups=["readers"])
new_user_access_token = artifactory.AccessToken("new_user",
username=new_user.name,
end_date_relative="5m")
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
newUser, err := artifactory.NewUser(ctx, "new_user", &artifactory.UserArgs{
Name: pulumi.String("new_user"),
Email: pulumi.String("new_user@somewhere.com"),
Groups: pulumi.StringArray{
pulumi.String("readers"),
},
})
if err != nil {
return err
}
_, err = artifactory.NewAccessToken(ctx, "new_user", &artifactory.AccessTokenArgs{
Username: newUser.Name,
EndDateRelative: pulumi.String("5m"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var newUser = new Artifactory.User("new_user", new()
{
Name = "new_user",
Email = "new_user@somewhere.com",
Groups = new[]
{
"readers",
},
});
var newUserAccessToken = new Artifactory.AccessToken("new_user", new()
{
Username = newUser.Name,
EndDateRelative = "5m",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.User;
import com.pulumi.artifactory.UserArgs;
import com.pulumi.artifactory.AccessToken;
import com.pulumi.artifactory.AccessTokenArgs;
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 newUser = new User("newUser", UserArgs.builder()
.name("new_user")
.email("new_user@somewhere.com")
.groups("readers")
.build());
var newUserAccessToken = new AccessToken("newUserAccessToken", AccessTokenArgs.builder()
.username(newUser.name())
.endDateRelative("5m")
.build());
}
}
resources:
newUser:
type: artifactory:User
name: new_user
properties:
name: new_user
email: new_user@somewhere.com
groups:
- readers
newUserAccessToken:
type: artifactory:AccessToken
name: new_user
properties:
username: ${newUser.name}
endDateRelative: 5m
Creates a new token for groups
This creates a transient user called temporary-user
.
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const temporaryUser = new artifactory.AccessToken("temporary_user", {
username: "temporary-user",
endDateRelative: "1h",
groups: ["readers"],
});
import pulumi
import pulumi_artifactory as artifactory
temporary_user = artifactory.AccessToken("temporary_user",
username="temporary-user",
end_date_relative="1h",
groups=["readers"])
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := artifactory.NewAccessToken(ctx, "temporary_user", &artifactory.AccessTokenArgs{
Username: pulumi.String("temporary-user"),
EndDateRelative: pulumi.String("1h"),
Groups: pulumi.StringArray{
pulumi.String("readers"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var temporaryUser = new Artifactory.AccessToken("temporary_user", new()
{
Username = "temporary-user",
EndDateRelative = "1h",
Groups = new[]
{
"readers",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.AccessToken;
import com.pulumi.artifactory.AccessTokenArgs;
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 temporaryUser = new AccessToken("temporaryUser", AccessTokenArgs.builder()
.username("temporary-user")
.endDateRelative("1h")
.groups("readers")
.build());
}
}
resources:
temporaryUser:
type: artifactory:AccessToken
name: temporary_user
properties:
username: temporary-user
endDateRelative: 1h
groups:
- readers
Create token with no expiry
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const noExpiry = new artifactory.AccessToken("no_expiry", {
username: "existing-user",
endDateRelative: "0s",
});
import pulumi
import pulumi_artifactory as artifactory
no_expiry = artifactory.AccessToken("no_expiry",
username="existing-user",
end_date_relative="0s")
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := artifactory.NewAccessToken(ctx, "no_expiry", &artifactory.AccessTokenArgs{
Username: pulumi.String("existing-user"),
EndDateRelative: pulumi.String("0s"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var noExpiry = new Artifactory.AccessToken("no_expiry", new()
{
Username = "existing-user",
EndDateRelative = "0s",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.AccessToken;
import com.pulumi.artifactory.AccessTokenArgs;
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 noExpiry = new AccessToken("noExpiry", AccessTokenArgs.builder()
.username("existing-user")
.endDateRelative("0s")
.build());
}
}
resources:
noExpiry:
type: artifactory:AccessToken
name: no_expiry
properties:
username: existing-user
endDateRelative: 0s
Creates a refreshable token
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const refreshable = new artifactory.AccessToken("refreshable", {
username: "refreshable",
endDateRelative: "1m",
refreshable: true,
groups: ["readers"],
});
import pulumi
import pulumi_artifactory as artifactory
refreshable = artifactory.AccessToken("refreshable",
username="refreshable",
end_date_relative="1m",
refreshable=True,
groups=["readers"])
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := artifactory.NewAccessToken(ctx, "refreshable", &artifactory.AccessTokenArgs{
Username: pulumi.String("refreshable"),
EndDateRelative: pulumi.String("1m"),
Refreshable: pulumi.Bool(true),
Groups: pulumi.StringArray{
pulumi.String("readers"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var refreshable = new Artifactory.AccessToken("refreshable", new()
{
Username = "refreshable",
EndDateRelative = "1m",
Refreshable = true,
Groups = new[]
{
"readers",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.AccessToken;
import com.pulumi.artifactory.AccessTokenArgs;
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 refreshable = new AccessToken("refreshable", AccessTokenArgs.builder()
.username("refreshable")
.endDateRelative("1m")
.refreshable(true)
.groups("readers")
.build());
}
}
resources:
refreshable:
type: artifactory:AccessToken
properties:
username: refreshable
endDateRelative: 1m
refreshable: true
groups:
- readers
Creates an administrator token
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const admin = new artifactory.AccessToken("admin", {
username: "admin",
endDateRelative: "1m",
adminToken: {
instanceId: "<instance id>",
},
});
import pulumi
import pulumi_artifactory as artifactory
admin = artifactory.AccessToken("admin",
username="admin",
end_date_relative="1m",
admin_token=artifactory.AccessTokenAdminTokenArgs(
instance_id="<instance id>",
))
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := artifactory.NewAccessToken(ctx, "admin", &artifactory.AccessTokenArgs{
Username: pulumi.String("admin"),
EndDateRelative: pulumi.String("1m"),
AdminToken: &artifactory.AccessTokenAdminTokenArgs{
InstanceId: pulumi.String("<instance id>"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var admin = new Artifactory.AccessToken("admin", new()
{
Username = "admin",
EndDateRelative = "1m",
AdminToken = new Artifactory.Inputs.AccessTokenAdminTokenArgs
{
InstanceId = "<instance id>",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.AccessToken;
import com.pulumi.artifactory.AccessTokenArgs;
import com.pulumi.artifactory.inputs.AccessTokenAdminTokenArgs;
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 admin = new AccessToken("admin", AccessTokenArgs.builder()
.username("admin")
.endDateRelative("1m")
.adminToken(AccessTokenAdminTokenArgs.builder()
.instanceId("<instance id>")
.build())
.build());
}
}
resources:
admin:
type: artifactory:AccessToken
properties:
username: admin
endDateRelative: 1m
adminToken:
instanceId: <instance id>
Creates a token with an audience
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const audience = new artifactory.AccessToken("audience", {
username: "audience",
endDateRelative: "1m",
audience: "jfrt@*",
refreshable: true,
});
import pulumi
import pulumi_artifactory as artifactory
audience = artifactory.AccessToken("audience",
username="audience",
end_date_relative="1m",
audience="jfrt@*",
refreshable=True)
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := artifactory.NewAccessToken(ctx, "audience", &artifactory.AccessTokenArgs{
Username: pulumi.String("audience"),
EndDateRelative: pulumi.String("1m"),
Audience: pulumi.String("jfrt@*"),
Refreshable: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var audience = new Artifactory.AccessToken("audience", new()
{
Username = "audience",
EndDateRelative = "1m",
Audience = "jfrt@*",
Refreshable = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.AccessToken;
import com.pulumi.artifactory.AccessTokenArgs;
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 audience = new AccessToken("audience", AccessTokenArgs.builder()
.username("audience")
.endDateRelative("1m")
.audience("jfrt@*")
.refreshable(true)
.build());
}
}
resources:
audience:
type: artifactory:AccessToken
properties:
username: audience
endDateRelative: 1m
audience: jfrt@*
refreshable: true
Creates a token with a fixed end date
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const fixeddate = new artifactory.AccessToken("fixeddate", {
username: "fixeddate",
endDate: "2018-01-01T01:02:03Z",
groups: ["readers"],
});
import pulumi
import pulumi_artifactory as artifactory
fixeddate = artifactory.AccessToken("fixeddate",
username="fixeddate",
end_date="2018-01-01T01:02:03Z",
groups=["readers"])
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := artifactory.NewAccessToken(ctx, "fixeddate", &artifactory.AccessTokenArgs{
Username: pulumi.String("fixeddate"),
EndDate: pulumi.String("2018-01-01T01:02:03Z"),
Groups: pulumi.StringArray{
pulumi.String("readers"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var fixeddate = new Artifactory.AccessToken("fixeddate", new()
{
Username = "fixeddate",
EndDate = "2018-01-01T01:02:03Z",
Groups = new[]
{
"readers",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.AccessToken;
import com.pulumi.artifactory.AccessTokenArgs;
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 fixeddate = new AccessToken("fixeddate", AccessTokenArgs.builder()
.username("fixeddate")
.endDate("2018-01-01T01:02:03Z")
.groups("readers")
.build());
}
}
resources:
fixeddate:
type: artifactory:AccessToken
properties:
username: fixeddate
endDate: 2018-01-01T01:02:03Z
groups:
- readers
Rotate token after it expires
This example will generate a token that will expire in 1 hour.
If pulumi up
is run before 1 hour, nothing changes.
One an hour has passed, pulumi up
will generate a new token.
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
import * as time from "@pulumiverse/time";
const nowPlus1Hours = new time.Rotating("now_plus_1_hours", {rotationHours: 1});
const rotating = new artifactory.AccessToken("rotating", {
username: "rotating",
endDate: nowPlus1Hour.rotationRfc3339,
groups: ["readers"],
});
import pulumi
import pulumi_artifactory as artifactory
import pulumiverse_time as time
now_plus1_hours = time.Rotating("now_plus_1_hours", rotation_hours=1)
rotating = artifactory.AccessToken("rotating",
username="rotating",
end_date=now_plus1_hour["rotationRfc3339"],
groups=["readers"])
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
"github.com/pulumi/pulumi-time/sdk/go/time"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := time.NewRotating(ctx, "now_plus_1_hours", &time.RotatingArgs{
RotationHours: pulumi.Int(1),
})
if err != nil {
return err
}
_, err = artifactory.NewAccessToken(ctx, "rotating", &artifactory.AccessTokenArgs{
Username: pulumi.String("rotating"),
EndDate: pulumi.Any(nowPlus1Hour.RotationRfc3339),
Groups: pulumi.StringArray{
pulumi.String("readers"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
using Time = Pulumiverse.Time;
return await Deployment.RunAsync(() =>
{
var nowPlus1Hours = new Time.Rotating("now_plus_1_hours", new()
{
RotationHours = 1,
});
var rotating = new Artifactory.AccessToken("rotating", new()
{
Username = "rotating",
EndDate = nowPlus1Hour.RotationRfc3339,
Groups = new[]
{
"readers",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.time.Rotating;
import com.pulumi.time.RotatingArgs;
import com.pulumi.artifactory.AccessToken;
import com.pulumi.artifactory.AccessTokenArgs;
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 nowPlus1Hours = new Rotating("nowPlus1Hours", RotatingArgs.builder()
.rotationHours("1")
.build());
var rotating = new AccessToken("rotating", AccessTokenArgs.builder()
.username("rotating")
.endDate(nowPlus1Hour.rotationRfc3339())
.groups("readers")
.build());
}
}
resources:
nowPlus1Hours:
type: time:Rotating
name: now_plus_1_hours
properties:
rotationHours: '1'
rotating:
type: artifactory:AccessToken
properties:
username: rotating
endDate: ${nowPlus1Hour.rotationRfc3339}
groups:
- readers
Rotate token each pulumi up
This example will generate a token that will expire in 1 hour.
If pulumi up
is run before 1 hour, a new token is generated with an expiry of 1 hour.
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
import * as std from "@pulumi/std";
import * as time from "@pulumiverse/time";
const nowPlus1Hours = new time.Rotating("now_plus_1_hours", {
triggers: {
key: std.timestamp({}).then(invoke => invoke.result),
},
rotationHours: 1,
});
const rotating = new artifactory.AccessToken("rotating", {
username: "rotating",
endDate: nowPlus1Hour.rotationRfc3339,
groups: ["readers"],
});
import pulumi
import pulumi_artifactory as artifactory
import pulumi_std as std
import pulumiverse_time as time
now_plus1_hours = time.Rotating("now_plus_1_hours",
triggers={
"key": std.timestamp().result,
},
rotation_hours=1)
rotating = artifactory.AccessToken("rotating",
username="rotating",
end_date=now_plus1_hour["rotationRfc3339"],
groups=["readers"])
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi-time/sdk/go/time"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
invokeTimestamp, err := std.Timestamp(ctx, nil, nil)
if err != nil {
return err
}
_, err = time.NewRotating(ctx, "now_plus_1_hours", &time.RotatingArgs{
Triggers: pulumi.StringMap{
"key": invokeTimestamp.Result,
},
RotationHours: pulumi.Int(1),
})
if err != nil {
return err
}
_, err = artifactory.NewAccessToken(ctx, "rotating", &artifactory.AccessTokenArgs{
Username: pulumi.String("rotating"),
EndDate: pulumi.Any(nowPlus1Hour.RotationRfc3339),
Groups: pulumi.StringArray{
pulumi.String("readers"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
using Std = Pulumi.Std;
using Time = Pulumiverse.Time;
return await Deployment.RunAsync(() =>
{
var nowPlus1Hours = new Time.Rotating("now_plus_1_hours", new()
{
Triggers =
{
{ "key", Std.Timestamp.Invoke().Apply(invoke => invoke.Result) },
},
RotationHours = 1,
});
var rotating = new Artifactory.AccessToken("rotating", new()
{
Username = "rotating",
EndDate = nowPlus1Hour.RotationRfc3339,
Groups = new[]
{
"readers",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.time.Rotating;
import com.pulumi.time.RotatingArgs;
import com.pulumi.artifactory.AccessToken;
import com.pulumi.artifactory.AccessTokenArgs;
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 nowPlus1Hours = new Rotating("nowPlus1Hours", RotatingArgs.builder()
.triggers(Map.of("key", StdFunctions.timestamp().result()))
.rotationHours("1")
.build());
var rotating = new AccessToken("rotating", AccessTokenArgs.builder()
.username("rotating")
.endDate(nowPlus1Hour.rotationRfc3339())
.groups("readers")
.build());
}
}
resources:
nowPlus1Hours:
type: time:Rotating
name: now_plus_1_hours
properties:
triggers:
key:
fn::invoke:
Function: std:timestamp
Arguments: {}
Return: result
rotationHours: '1'
rotating:
type: artifactory:AccessToken
properties:
username: rotating
endDate: ${nowPlus1Hour.rotationRfc3339}
groups:
- readers
References
- https://www.jfrog.com/confluence/display/ACC1X/Access+Tokens
- https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API#ArtifactoryRESTAPI-CreateToken
Create AccessToken Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new AccessToken(name: string, args: AccessTokenArgs, opts?: CustomResourceOptions);
@overload
def AccessToken(resource_name: str,
args: AccessTokenArgs,
opts: Optional[ResourceOptions] = None)
@overload
def AccessToken(resource_name: str,
opts: Optional[ResourceOptions] = None,
username: Optional[str] = None,
admin_token: Optional[AccessTokenAdminTokenArgs] = None,
audience: Optional[str] = None,
end_date: Optional[str] = None,
end_date_relative: Optional[str] = None,
groups: Optional[Sequence[str]] = None,
refreshable: Optional[bool] = None)
func NewAccessToken(ctx *Context, name string, args AccessTokenArgs, opts ...ResourceOption) (*AccessToken, error)
public AccessToken(string name, AccessTokenArgs args, CustomResourceOptions? opts = null)
public AccessToken(String name, AccessTokenArgs args)
public AccessToken(String name, AccessTokenArgs args, CustomResourceOptions options)
type: artifactory:AccessToken
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 AccessTokenArgs
- 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 AccessTokenArgs
- 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 AccessTokenArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AccessTokenArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AccessTokenArgs
- 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 accessTokenResource = new Artifactory.AccessToken("accessTokenResource", new()
{
Username = "string",
AdminToken = new Artifactory.Inputs.AccessTokenAdminTokenArgs
{
InstanceId = "string",
},
Audience = "string",
EndDate = "string",
EndDateRelative = "string",
Groups = new[]
{
"string",
},
Refreshable = false,
});
example, err := artifactory.NewAccessToken(ctx, "accessTokenResource", &artifactory.AccessTokenArgs{
Username: pulumi.String("string"),
AdminToken: &artifactory.AccessTokenAdminTokenArgs{
InstanceId: pulumi.String("string"),
},
Audience: pulumi.String("string"),
EndDate: pulumi.String("string"),
EndDateRelative: pulumi.String("string"),
Groups: pulumi.StringArray{
pulumi.String("string"),
},
Refreshable: pulumi.Bool(false),
})
var accessTokenResource = new AccessToken("accessTokenResource", AccessTokenArgs.builder()
.username("string")
.adminToken(AccessTokenAdminTokenArgs.builder()
.instanceId("string")
.build())
.audience("string")
.endDate("string")
.endDateRelative("string")
.groups("string")
.refreshable(false)
.build());
access_token_resource = artifactory.AccessToken("accessTokenResource",
username="string",
admin_token=artifactory.AccessTokenAdminTokenArgs(
instance_id="string",
),
audience="string",
end_date="string",
end_date_relative="string",
groups=["string"],
refreshable=False)
const accessTokenResource = new artifactory.AccessToken("accessTokenResource", {
username: "string",
adminToken: {
instanceId: "string",
},
audience: "string",
endDate: "string",
endDateRelative: "string",
groups: ["string"],
refreshable: false,
});
type: artifactory:AccessToken
properties:
adminToken:
instanceId: string
audience: string
endDate: string
endDateRelative: string
groups:
- string
refreshable: false
username: string
AccessToken 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 AccessToken resource accepts the following input properties:
- Username string
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set. - Admin
Token AccessToken Admin Token - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - Audience string
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - End
Date string - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - End
Date stringRelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - Groups List<string>
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - Refreshable bool
- (Optional) Is this token refreshable? Defaults to
false
- Username string
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set. - Admin
Token AccessToken Admin Token Args - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - Audience string
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - End
Date string - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - End
Date stringRelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - Groups []string
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - Refreshable bool
- (Optional) Is this token refreshable? Defaults to
false
- username String
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set. - admin
Token AccessToken Admin Token - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - audience String
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - end
Date String - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - end
Date StringRelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - groups List<String>
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - refreshable Boolean
- (Optional) Is this token refreshable? Defaults to
false
- username string
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set. - admin
Token AccessToken Admin Token - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - audience string
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - end
Date string - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - end
Date stringRelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - groups string[]
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - refreshable boolean
- (Optional) Is this token refreshable? Defaults to
false
- username str
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set. - admin_
token AccessToken Admin Token Args - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - audience str
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - end_
date str - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - end_
date_ strrelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - groups Sequence[str]
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - refreshable bool
- (Optional) Is this token refreshable? Defaults to
false
- username String
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set. - admin
Token Property Map - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - audience String
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - end
Date String - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - end
Date StringRelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - groups List<String>
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - refreshable Boolean
- (Optional) Is this token refreshable? Defaults to
false
Outputs
All input properties are implicitly available as output properties. Additionally, the AccessToken resource produces the following output properties:
- Details string
- Returns the access token to authenciate to Artifactory
- Id string
- The provider-assigned unique ID for this managed resource.
- Refresh
Token string - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false.
- Access
Token string - Returns the access token to authenciate to Artifactory
- Id string
- The provider-assigned unique ID for this managed resource.
- Refresh
Token string - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false.
- access
Token String - Returns the access token to authenciate to Artifactory
- id String
- The provider-assigned unique ID for this managed resource.
- refresh
Token String - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false.
- access
Token string - Returns the access token to authenciate to Artifactory
- id string
- The provider-assigned unique ID for this managed resource.
- refresh
Token string - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false.
- access_
token str - Returns the access token to authenciate to Artifactory
- id str
- The provider-assigned unique ID for this managed resource.
- refresh_
token str - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false.
- access
Token String - Returns the access token to authenciate to Artifactory
- id String
- The provider-assigned unique ID for this managed resource.
- refresh
Token String - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false.
Look up Existing AccessToken Resource
Get an existing AccessToken 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?: AccessTokenState, opts?: CustomResourceOptions): AccessToken
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
access_token: Optional[str] = None,
admin_token: Optional[AccessTokenAdminTokenArgs] = None,
audience: Optional[str] = None,
end_date: Optional[str] = None,
end_date_relative: Optional[str] = None,
groups: Optional[Sequence[str]] = None,
refresh_token: Optional[str] = None,
refreshable: Optional[bool] = None,
username: Optional[str] = None) -> AccessToken
func GetAccessToken(ctx *Context, name string, id IDInput, state *AccessTokenState, opts ...ResourceOption) (*AccessToken, error)
public static AccessToken Get(string name, Input<string> id, AccessTokenState? state, CustomResourceOptions? opts = null)
public static AccessToken get(String name, Output<String> id, AccessTokenState 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.
- Admin
Token AccessToken Admin Token - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - Audience string
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - Details string
- Returns the access token to authenciate to Artifactory
- End
Date string - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - End
Date stringRelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - Groups List<string>
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - Refresh
Token string - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false. - Refreshable bool
- (Optional) Is this token refreshable? Defaults to
false
- Username string
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set.
- Access
Token string - Returns the access token to authenciate to Artifactory
- Admin
Token AccessToken Admin Token Args - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - Audience string
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - End
Date string - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - End
Date stringRelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - Groups []string
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - Refresh
Token string - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false. - Refreshable bool
- (Optional) Is this token refreshable? Defaults to
false
- Username string
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set.
- access
Token String - Returns the access token to authenciate to Artifactory
- admin
Token AccessToken Admin Token - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - audience String
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - end
Date String - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - end
Date StringRelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - groups List<String>
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - refresh
Token String - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false. - refreshable Boolean
- (Optional) Is this token refreshable? Defaults to
false
- username String
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set.
- access
Token string - Returns the access token to authenciate to Artifactory
- admin
Token AccessToken Admin Token - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - audience string
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - end
Date string - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - end
Date stringRelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - groups string[]
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - refresh
Token string - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false. - refreshable boolean
- (Optional) Is this token refreshable? Defaults to
false
- username string
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set.
- access_
token str - Returns the access token to authenciate to Artifactory
- admin_
token AccessToken Admin Token Args - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - audience str
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - end_
date str - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - end_
date_ strrelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - groups Sequence[str]
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - refresh_
token str - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false. - refreshable bool
- (Optional) Is this token refreshable? Defaults to
false
- username str
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set.
- access
Token String - Returns the access token to authenciate to Artifactory
- admin
Token Property Map - (Optional) Specify the
instance_id
in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin.admin_token
cannot be specified withgroups
. - audience String
- (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set
"jfrt@*"
so the token to be accepted by all Artifactory instances. - end
Date String - (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g.
2018-01-01T01:02:03Z
). - end
Date StringRelative - (Optional) A relative duration for which the token is valid until, for example
240h
(10 days) or2400h30m
. Valid time units are "s", "m", "h". - groups List<String>
- (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify
["*"]
for all groups that the user belongs to.groups
cannot be specified withadmin_token
. - refresh
Token String - Returns the refresh token when
refreshable
is true, or an empty string whenrefreshable
is false. - refreshable Boolean
- (Optional) Is this token refreshable? Defaults to
false
- username String
- (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require
groups
to be set.
Supporting Types
AccessTokenAdminToken, AccessTokenAdminTokenArgs
- Instance
Id string
- Instance
Id string
- instance
Id String
- instance
Id string
- instance_
id str
- instance
Id String
Import
Artifactory does not retain access tokens and cannot be imported into state.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- artifactory pulumi/pulumi-artifactory
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
artifactory
Terraform Provider.