Viewing docs for HashiCorp Vault v7.11.1
published on Tuesday, Aug 11, 2026 by Pulumi
published on Tuesday, Aug 11, 2026 by Pulumi
Viewing docs for HashiCorp Vault v7.11.1
published on Tuesday, Aug 11, 2026 by Pulumi
published on Tuesday, Aug 11, 2026 by Pulumi
Reads the current CORS (Cross-Origin Resource Sharing) configuration from Vault.
Important This data source reads from the root namespace only.
Note This feature is available in Vault 1.14+
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";
const current = vault.getSysConfigCors({});
export const corsEnabled = current.then(current => current.enabled);
export const allowedOrigins = current.then(current => current.allowedOrigins);
export const allowedHeaders = current.then(current => current.allowedHeaders);
import pulumi
import pulumi_vault as vault
current = vault.get_sys_config_cors()
pulumi.export("corsEnabled", current.enabled)
pulumi.export("allowedOrigins", current.allowed_origins)
pulumi.export("allowedHeaders", current.allowed_headers)
package main
import (
"github.com/pulumi/pulumi-vault/sdk/v7/go/vault"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
current, err := vault.GetSysConfigCors(ctx, map[string]interface{}{}, nil)
if err != nil {
return err
}
ctx.Export("corsEnabled", current.Enabled)
ctx.Export("allowedOrigins", current.AllowedOrigins)
ctx.Export("allowedHeaders", current.AllowedHeaders)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vault = Pulumi.Vault;
return await Deployment.RunAsync(() =>
{
var current = Vault.GetSysConfigCors.Invoke();
return new Dictionary<string, object?>
{
["corsEnabled"] = current.Apply(getSysConfigCorsResult => getSysConfigCorsResult.Enabled),
["allowedOrigins"] = current.Apply(getSysConfigCorsResult => getSysConfigCorsResult.AllowedOrigins),
["allowedHeaders"] = current.Apply(getSysConfigCorsResult => getSysConfigCorsResult.AllowedHeaders),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.VaultFunctions;
import java.util.ArrayList;
import java.util.Arrays;
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) {
final var current = VaultFunctions.getSysConfigCors(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
ctx.export("corsEnabled", current.enabled());
ctx.export("allowedOrigins", current.allowedOrigins());
ctx.export("allowedHeaders", current.allowedHeaders());
}
}
variables:
current:
fn::invoke:
function: vault:getSysConfigCors
arguments: {}
outputs:
corsEnabled: ${current.enabled}
allowedOrigins: ${current.allowedOrigins}
allowedHeaders: ${current.allowedHeaders}
pulumi {
required_providers {
vault = {
source = "pulumi/vault"
}
}
}
data "vault_getsysconfigcors" "current" {
}
output "corsEnabled" {
value = data.vault_getsysconfigcors.current.enabled
}
output "allowedOrigins" {
value = data.vault_getsysconfigcors.current.allowed_origins
}
output "allowedHeaders" {
value = data.vault_getsysconfigcors.current.allowed_headers
}
Using with resource
import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";
const production = new vault.SysConfigCors("production", {
allowedOrigins: [
"https://app.example.com",
"https://admin.example.com",
"https://api.example.com",
],
allowedHeaders: [
"X-Custom-Header",
"X-Request-ID",
"X-Application-Version",
],
});
const current = vault.getSysConfigCors({});
export const corsConfiguration = {
enabled: current.then(current => current.enabled),
allowedOrigins: current.then(current => current.allowedOrigins),
allowedHeaders: current.then(current => current.allowedHeaders),
};
import pulumi
import pulumi_vault as vault
production = vault.SysConfigCors("production",
allowed_origins=[
"https://app.example.com",
"https://admin.example.com",
"https://api.example.com",
],
allowed_headers=[
"X-Custom-Header",
"X-Request-ID",
"X-Application-Version",
])
current = vault.get_sys_config_cors()
pulumi.export("corsConfiguration", {
"enabled": current.enabled,
"allowedOrigins": current.allowed_origins,
"allowedHeaders": current.allowed_headers,
})
package main
import (
"github.com/pulumi/pulumi-vault/sdk/v7/go/vault"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := vault.NewSysConfigCors(ctx, "production", &vault.SysConfigCorsArgs{
AllowedOrigins: pulumi.StringArray{
pulumi.String("https://app.example.com"),
pulumi.String("https://admin.example.com"),
pulumi.String("https://api.example.com"),
},
AllowedHeaders: pulumi.StringArray{
pulumi.String("X-Custom-Header"),
pulumi.String("X-Request-ID"),
pulumi.String("X-Application-Version"),
},
})
if err != nil {
return err
}
current, err := vault.GetSysConfigCors(ctx, map[string]interface{}{}, nil)
if err != nil {
return err
}
ctx.Export("corsConfiguration", pulumi.Map{
"enabled": current.Enabled,
"allowedOrigins": current.AllowedOrigins,
"allowedHeaders": current.AllowedHeaders,
})
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vault = Pulumi.Vault;
return await Deployment.RunAsync(() =>
{
var production = new Vault.SysConfigCors("production", new()
{
AllowedOrigins = new[]
{
"https://app.example.com",
"https://admin.example.com",
"https://api.example.com",
},
AllowedHeaders = new[]
{
"X-Custom-Header",
"X-Request-ID",
"X-Application-Version",
},
});
var current = Vault.GetSysConfigCors.Invoke();
return new Dictionary<string, object?>
{
["corsConfiguration"] =
{
{ "enabled", current.Apply(getSysConfigCorsResult => getSysConfigCorsResult.Enabled) },
{ "allowedOrigins", current.Apply(getSysConfigCorsResult => getSysConfigCorsResult.AllowedOrigins) },
{ "allowedHeaders", current.Apply(getSysConfigCorsResult => getSysConfigCorsResult.AllowedHeaders) },
},
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.SysConfigCors;
import com.pulumi.vault.SysConfigCorsArgs;
import com.pulumi.vault.VaultFunctions;
import java.util.ArrayList;
import java.util.Arrays;
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 production = new SysConfigCors("production", SysConfigCorsArgs.builder()
.allowedOrigins(
"https://app.example.com",
"https://admin.example.com",
"https://api.example.com")
.allowedHeaders(
"X-Custom-Header",
"X-Request-ID",
"X-Application-Version")
.build());
final var current = VaultFunctions.getSysConfigCors(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
ctx.export("corsConfiguration", Map.ofEntries(
Map.entry("enabled", current.enabled()),
Map.entry("allowedOrigins", current.allowedOrigins()),
Map.entry("allowedHeaders", current.allowedHeaders())
));
}
}
resources:
production:
type: vault:SysConfigCors
properties:
allowedOrigins:
- https://app.example.com
- https://admin.example.com
- https://api.example.com
allowedHeaders:
- X-Custom-Header
- X-Request-ID
- X-Application-Version
variables:
current:
fn::invoke:
function: vault:getSysConfigCors
arguments: {}
outputs:
corsConfiguration:
enabled: ${current.enabled}
allowedOrigins: ${current.allowedOrigins}
allowedHeaders: ${current.allowedHeaders}
pulumi {
required_providers {
vault = {
source = "pulumi/vault"
}
}
}
data "vault_getsysconfigcors" "current" {
}
resource "vault_sysconfigcors" "production" {
allowed_origins = ["https://app.example.com", "https://admin.example.com", "https://api.example.com"]
allowed_headers = ["X-Custom-Header", "X-Request-ID", "X-Application-Version"]
}
output "corsConfiguration" {
value = {
"enabled" = data.vault_getsysconfigcors.current.enabled
"allowedOrigins" = data.vault_getsysconfigcors.current.allowed_origins
"allowedHeaders" = data.vault_getsysconfigcors.current.allowed_headers
}
}
API Documentation
For more information on the Vault CORS configuration API, see the Vault API documentation.
Using getSysConfigCors
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getSysConfigCors(opts?: InvokeOptions): Promise<GetSysConfigCorsResult>
function getSysConfigCorsOutput(opts?: InvokeOptions): Output<GetSysConfigCorsResult>def get_sys_config_cors(opts: Optional[InvokeOptions] = None) -> GetSysConfigCorsResult
def get_sys_config_cors_output(opts: Optional[InvokeOptions] = None) -> Output[GetSysConfigCorsResult]func LookupSysConfigCors(ctx *Context, opts ...InvokeOption) (*LookupSysConfigCorsResult, error)
func LookupSysConfigCorsOutput(ctx *Context, opts ...InvokeOption) LookupSysConfigCorsResultOutput> Note: This function is named LookupSysConfigCors in the Go SDK.
public static class GetSysConfigCors
{
public static Task<GetSysConfigCorsResult> InvokeAsync(InvokeOptions? opts = null)
public static Output<GetSysConfigCorsResult> Invoke(InvokeOptions? opts = null)
}public static CompletableFuture<GetSysConfigCorsResult> getSysConfigCors(InvokeOptions options)
public static Output<GetSysConfigCorsResult> getSysConfigCors(InvokeOptions options)
fn::invoke:
function: vault:index/getSysConfigCors:getSysConfigCors
arguments:
# arguments dictionarydata "vault_get_sys_config_cors" "name" {
# arguments
}getSysConfigCors Result
The following output properties are available:
- Allowed
Headers List<string> - Set of additional custom headers allowed on cross-origin requests. Returns an empty set if CORS is disabled or no custom headers are configured. This only includes custom headers that were explicitly configured, not the standard Vault headers (Content-Type, X-Requested-With, X-Vault-AWS-IAM-Server-ID, X-Vault-MFA, X-Vault-No-Request-Forwarding, X-Vault-Wrap-Format, X-Vault-Wrap-TTL, X-Vault-Policy-Override, Authorization, X-Vault-Token) that are automatically included when CORS is enabled.
- Allowed
Origins List<string> - Set of origins permitted to make cross-origin requests. Returns an empty set if CORS is disabled.
- Enabled bool
- Whether CORS is currently enabled.
- Allowed
Headers []string - Set of additional custom headers allowed on cross-origin requests. Returns an empty set if CORS is disabled or no custom headers are configured. This only includes custom headers that were explicitly configured, not the standard Vault headers (Content-Type, X-Requested-With, X-Vault-AWS-IAM-Server-ID, X-Vault-MFA, X-Vault-No-Request-Forwarding, X-Vault-Wrap-Format, X-Vault-Wrap-TTL, X-Vault-Policy-Override, Authorization, X-Vault-Token) that are automatically included when CORS is enabled.
- Allowed
Origins []string - Set of origins permitted to make cross-origin requests. Returns an empty set if CORS is disabled.
- Enabled bool
- Whether CORS is currently enabled.
- allowed_
headers list(string) - Set of additional custom headers allowed on cross-origin requests. Returns an empty set if CORS is disabled or no custom headers are configured. This only includes custom headers that were explicitly configured, not the standard Vault headers (Content-Type, X-Requested-With, X-Vault-AWS-IAM-Server-ID, X-Vault-MFA, X-Vault-No-Request-Forwarding, X-Vault-Wrap-Format, X-Vault-Wrap-TTL, X-Vault-Policy-Override, Authorization, X-Vault-Token) that are automatically included when CORS is enabled.
- allowed_
origins list(string) - Set of origins permitted to make cross-origin requests. Returns an empty set if CORS is disabled.
- enabled bool
- Whether CORS is currently enabled.
- allowed
Headers List<String> - Set of additional custom headers allowed on cross-origin requests. Returns an empty set if CORS is disabled or no custom headers are configured. This only includes custom headers that were explicitly configured, not the standard Vault headers (Content-Type, X-Requested-With, X-Vault-AWS-IAM-Server-ID, X-Vault-MFA, X-Vault-No-Request-Forwarding, X-Vault-Wrap-Format, X-Vault-Wrap-TTL, X-Vault-Policy-Override, Authorization, X-Vault-Token) that are automatically included when CORS is enabled.
- allowed
Origins List<String> - Set of origins permitted to make cross-origin requests. Returns an empty set if CORS is disabled.
- enabled Boolean
- Whether CORS is currently enabled.
- allowed
Headers string[] - Set of additional custom headers allowed on cross-origin requests. Returns an empty set if CORS is disabled or no custom headers are configured. This only includes custom headers that were explicitly configured, not the standard Vault headers (Content-Type, X-Requested-With, X-Vault-AWS-IAM-Server-ID, X-Vault-MFA, X-Vault-No-Request-Forwarding, X-Vault-Wrap-Format, X-Vault-Wrap-TTL, X-Vault-Policy-Override, Authorization, X-Vault-Token) that are automatically included when CORS is enabled.
- allowed
Origins string[] - Set of origins permitted to make cross-origin requests. Returns an empty set if CORS is disabled.
- enabled boolean
- Whether CORS is currently enabled.
- allowed_
headers Sequence[str] - Set of additional custom headers allowed on cross-origin requests. Returns an empty set if CORS is disabled or no custom headers are configured. This only includes custom headers that were explicitly configured, not the standard Vault headers (Content-Type, X-Requested-With, X-Vault-AWS-IAM-Server-ID, X-Vault-MFA, X-Vault-No-Request-Forwarding, X-Vault-Wrap-Format, X-Vault-Wrap-TTL, X-Vault-Policy-Override, Authorization, X-Vault-Token) that are automatically included when CORS is enabled.
- allowed_
origins Sequence[str] - Set of origins permitted to make cross-origin requests. Returns an empty set if CORS is disabled.
- enabled bool
- Whether CORS is currently enabled.
- allowed
Headers List<String> - Set of additional custom headers allowed on cross-origin requests. Returns an empty set if CORS is disabled or no custom headers are configured. This only includes custom headers that were explicitly configured, not the standard Vault headers (Content-Type, X-Requested-With, X-Vault-AWS-IAM-Server-ID, X-Vault-MFA, X-Vault-No-Request-Forwarding, X-Vault-Wrap-Format, X-Vault-Wrap-TTL, X-Vault-Policy-Override, Authorization, X-Vault-Token) that are automatically included when CORS is enabled.
- allowed
Origins List<String> - Set of origins permitted to make cross-origin requests. Returns an empty set if CORS is disabled.
- enabled Boolean
- Whether CORS is currently enabled.
Package Details
- Repository
- Vault pulumi/pulumi-vault
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vaultTerraform Provider.
Viewing docs for HashiCorp Vault v7.11.1
published on Tuesday, Aug 11, 2026 by Pulumi
published on Tuesday, Aug 11, 2026 by Pulumi