Alibaba Cloud v3.87.0 published on Saturday, Oct 18, 2025 by Pulumi
alicloud.resourcemanager.getPolicyVersions
This data source provides the Resource Manager Policy Versions of the current Alibaba Cloud user.
NOTE: Available in 1.85.0+.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const _default = alicloud.resourcemanager.getPolicyVersions({
policyName: "tftest",
policyType: "Custom",
});
export const firstPolicyVersionId = _default.then(_default => _default.versions?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
default = alicloud.resourcemanager.get_policy_versions(policy_name="tftest",
policy_type="Custom")
pulumi.export("firstPolicyVersionId", default.versions[0].id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_default, err := resourcemanager.GetPolicyVersions(ctx, &resourcemanager.GetPolicyVersionsArgs{
PolicyName: "tftest",
PolicyType: "Custom",
}, nil)
if err != nil {
return err
}
ctx.Export("firstPolicyVersionId", _default.Versions[0].Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var @default = AliCloud.ResourceManager.GetPolicyVersions.Invoke(new()
{
PolicyName = "tftest",
PolicyType = "Custom",
});
return new Dictionary<string, object?>
{
["firstPolicyVersionId"] = @default.Apply(@default => @default.Apply(getPolicyVersionsResult => getPolicyVersionsResult.Versions[0]?.Id)),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.inputs.GetPolicyVersionsArgs;
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) {
final var default = ResourcemanagerFunctions.getPolicyVersions(GetPolicyVersionsArgs.builder()
.policyName("tftest")
.policyType("Custom")
.build());
ctx.export("firstPolicyVersionId", default_.versions()[0].id());
}
}
variables:
default:
fn::invoke:
function: alicloud:resourcemanager:getPolicyVersions
arguments:
policyName: tftest
policyType: Custom
outputs:
firstPolicyVersionId: ${default.versions[0].id}
Using getPolicyVersions
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 getPolicyVersions(args: GetPolicyVersionsArgs, opts?: InvokeOptions): Promise<GetPolicyVersionsResult>
function getPolicyVersionsOutput(args: GetPolicyVersionsOutputArgs, opts?: InvokeOptions): Output<GetPolicyVersionsResult>def get_policy_versions(enable_details: Optional[bool] = None,
ids: Optional[Sequence[str]] = None,
output_file: Optional[str] = None,
policy_name: Optional[str] = None,
policy_type: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPolicyVersionsResult
def get_policy_versions_output(enable_details: Optional[pulumi.Input[bool]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
output_file: Optional[pulumi.Input[str]] = None,
policy_name: Optional[pulumi.Input[str]] = None,
policy_type: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPolicyVersionsResult]func GetPolicyVersions(ctx *Context, args *GetPolicyVersionsArgs, opts ...InvokeOption) (*GetPolicyVersionsResult, error)
func GetPolicyVersionsOutput(ctx *Context, args *GetPolicyVersionsOutputArgs, opts ...InvokeOption) GetPolicyVersionsResultOutput> Note: This function is named GetPolicyVersions in the Go SDK.
public static class GetPolicyVersions
{
public static Task<GetPolicyVersionsResult> InvokeAsync(GetPolicyVersionsArgs args, InvokeOptions? opts = null)
public static Output<GetPolicyVersionsResult> Invoke(GetPolicyVersionsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetPolicyVersionsResult> getPolicyVersions(GetPolicyVersionsArgs args, InvokeOptions options)
public static Output<GetPolicyVersionsResult> getPolicyVersions(GetPolicyVersionsArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:resourcemanager/getPolicyVersions:getPolicyVersions
arguments:
# arguments dictionaryThe following arguments are supported:
- Policy
Name string - The name of the policy.
- Policy
Type string - The type of the policy. Valid values:
CustomandSystem. - Enable
Details bool - Default to
false. Set it to true can output more details. - Ids List<string>
- A list of policy version IDs.
- Output
File string - File name where to save data source results (after running
pulumi preview).
- Policy
Name string - The name of the policy.
- Policy
Type string - The type of the policy. Valid values:
CustomandSystem. - Enable
Details bool - Default to
false. Set it to true can output more details. - Ids []string
- A list of policy version IDs.
- Output
File string - File name where to save data source results (after running
pulumi preview).
- policy
Name String - The name of the policy.
- policy
Type String - The type of the policy. Valid values:
CustomandSystem. - enable
Details Boolean - Default to
false. Set it to true can output more details. - ids List<String>
- A list of policy version IDs.
- output
File String - File name where to save data source results (after running
pulumi preview).
- policy
Name string - The name of the policy.
- policy
Type string - The type of the policy. Valid values:
CustomandSystem. - enable
Details boolean - Default to
false. Set it to true can output more details. - ids string[]
- A list of policy version IDs.
- output
File string - File name where to save data source results (after running
pulumi preview).
- policy_
name str - The name of the policy.
- policy_
type str - The type of the policy. Valid values:
CustomandSystem. - enable_
details bool - Default to
false. Set it to true can output more details. - ids Sequence[str]
- A list of policy version IDs.
- output_
file str - File name where to save data source results (after running
pulumi preview).
- policy
Name String - The name of the policy.
- policy
Type String - The type of the policy. Valid values:
CustomandSystem. - enable
Details Boolean - Default to
false. Set it to true can output more details. - ids List<String>
- A list of policy version IDs.
- output
File String - File name where to save data source results (after running
pulumi preview).
getPolicyVersions Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- A list of policy version IDs.
- Policy
Name string - Policy
Type string - Versions
List<Pulumi.
Ali Cloud. Resource Manager. Outputs. Get Policy Versions Version> - A list of policy versions. Each element contains the following attributes:
- Enable
Details bool - Output
File string
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- A list of policy version IDs.
- Policy
Name string - Policy
Type string - Versions
[]Get
Policy Versions Version - A list of policy versions. Each element contains the following attributes:
- Enable
Details bool - Output
File string
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of policy version IDs.
- policy
Name String - policy
Type String - versions
List<Get
Policy Versions Version> - A list of policy versions. Each element contains the following attributes:
- enable
Details Boolean - output
File String
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- A list of policy version IDs.
- policy
Name string - policy
Type string - versions
Get
Policy Versions Version[] - A list of policy versions. Each element contains the following attributes:
- enable
Details boolean - output
File string
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- A list of policy version IDs.
- policy_
name str - policy_
type str - versions
Sequence[Get
Policy Versions Version] - A list of policy versions. Each element contains the following attributes:
- enable_
details bool - output_
file str
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of policy version IDs.
- policy
Name String - policy
Type String - versions List<Property Map>
- A list of policy versions. Each element contains the following attributes:
- enable
Details Boolean - output
File String
Supporting Types
GetPolicyVersionsVersion
- Id string
- The ID of the resource, the value is
<policy_name>:<version_id>. - Is
Default boolVersion - Indicates whether the policy version is the default version.
- Policy
Document string - (Available in v1.114.0+) The policy document of the policy version.
- Version
Id string - The ID of the policy version.
- Id string
- The ID of the resource, the value is
<policy_name>:<version_id>. - Is
Default boolVersion - Indicates whether the policy version is the default version.
- Policy
Document string - (Available in v1.114.0+) The policy document of the policy version.
- Version
Id string - The ID of the policy version.
- id String
- The ID of the resource, the value is
<policy_name>:<version_id>. - is
Default BooleanVersion - Indicates whether the policy version is the default version.
- policy
Document String - (Available in v1.114.0+) The policy document of the policy version.
- version
Id String - The ID of the policy version.
- id string
- The ID of the resource, the value is
<policy_name>:<version_id>. - is
Default booleanVersion - Indicates whether the policy version is the default version.
- policy
Document string - (Available in v1.114.0+) The policy document of the policy version.
- version
Id string - The ID of the policy version.
- id str
- The ID of the resource, the value is
<policy_name>:<version_id>. - is_
default_ boolversion - Indicates whether the policy version is the default version.
- policy_
document str - (Available in v1.114.0+) The policy document of the policy version.
- version_
id str - The ID of the policy version.
- id String
- The ID of the resource, the value is
<policy_name>:<version_id>. - is
Default BooleanVersion - Indicates whether the policy version is the default version.
- policy
Document String - (Available in v1.114.0+) The policy document of the policy version.
- version
Id String - The ID of the policy version.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.
