Google Cloud v8.21.0 published on Wednesday, Mar 5, 2025 by Pulumi
gcp.secretmanager.getSecretIamPolicy
Explore with Pulumi AI
Retrieves the current IAM policy data for secret
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const policy = gcp.secretmanager.getSecretIamPolicy({
    project: secret_basic.project,
    secretId: secret_basic.secretId,
});
import pulumi
import pulumi_gcp as gcp
policy = gcp.secretmanager.get_secret_iam_policy(project=secret_basic["project"],
    secret_id=secret_basic["secretId"])
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/secretmanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := secretmanager.LookupSecretIamPolicy(ctx, &secretmanager.LookupSecretIamPolicyArgs{
			Project:  pulumi.StringRef(secret_basic.Project),
			SecretId: secret_basic.SecretId,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var policy = Gcp.SecretManager.GetSecretIamPolicy.Invoke(new()
    {
        Project = secret_basic.Project,
        SecretId = secret_basic.SecretId,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.secretmanager.SecretmanagerFunctions;
import com.pulumi.gcp.secretmanager.inputs.GetSecretIamPolicyArgs;
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 policy = SecretmanagerFunctions.getSecretIamPolicy(GetSecretIamPolicyArgs.builder()
            .project(secret_basic.project())
            .secretId(secret_basic.secretId())
            .build());
    }
}
variables:
  policy:
    fn::invoke:
      function: gcp:secretmanager:getSecretIamPolicy
      arguments:
        project: ${["secret-basic"].project}
        secretId: ${["secret-basic"].secretId}
Using getSecretIamPolicy
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 getSecretIamPolicy(args: GetSecretIamPolicyArgs, opts?: InvokeOptions): Promise<GetSecretIamPolicyResult>
function getSecretIamPolicyOutput(args: GetSecretIamPolicyOutputArgs, opts?: InvokeOptions): Output<GetSecretIamPolicyResult>def get_secret_iam_policy(project: Optional[str] = None,
                          secret_id: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetSecretIamPolicyResult
def get_secret_iam_policy_output(project: Optional[pulumi.Input[str]] = None,
                          secret_id: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetSecretIamPolicyResult]func LookupSecretIamPolicy(ctx *Context, args *LookupSecretIamPolicyArgs, opts ...InvokeOption) (*LookupSecretIamPolicyResult, error)
func LookupSecretIamPolicyOutput(ctx *Context, args *LookupSecretIamPolicyOutputArgs, opts ...InvokeOption) LookupSecretIamPolicyResultOutput> Note: This function is named LookupSecretIamPolicy in the Go SDK.
public static class GetSecretIamPolicy 
{
    public static Task<GetSecretIamPolicyResult> InvokeAsync(GetSecretIamPolicyArgs args, InvokeOptions? opts = null)
    public static Output<GetSecretIamPolicyResult> Invoke(GetSecretIamPolicyInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetSecretIamPolicyResult> getSecretIamPolicy(GetSecretIamPolicyArgs args, InvokeOptions options)
public static Output<GetSecretIamPolicyResult> getSecretIamPolicy(GetSecretIamPolicyArgs args, InvokeOptions options)
fn::invoke:
  function: gcp:secretmanager/getSecretIamPolicy:getSecretIamPolicy
  arguments:
    # arguments dictionaryThe following arguments are supported:
getSecretIamPolicy Result
The following output properties are available:
- Etag string
- (Computed) The etag of the IAM policy.
- Id string
- The provider-assigned unique ID for this managed resource.
- PolicyData string
- (Required only by gcp.secretmanager.SecretIamPolicy) The policy data generated by agcp.organizations.getIAMPolicydata source.
- Project string
- SecretId string
- Etag string
- (Computed) The etag of the IAM policy.
- Id string
- The provider-assigned unique ID for this managed resource.
- PolicyData string
- (Required only by gcp.secretmanager.SecretIamPolicy) The policy data generated by agcp.organizations.getIAMPolicydata source.
- Project string
- SecretId string
- etag String
- (Computed) The etag of the IAM policy.
- id String
- The provider-assigned unique ID for this managed resource.
- policyData String
- (Required only by gcp.secretmanager.SecretIamPolicy) The policy data generated by agcp.organizations.getIAMPolicydata source.
- project String
- secretId String
- etag string
- (Computed) The etag of the IAM policy.
- id string
- The provider-assigned unique ID for this managed resource.
- policyData string
- (Required only by gcp.secretmanager.SecretIamPolicy) The policy data generated by agcp.organizations.getIAMPolicydata source.
- project string
- secretId string
- etag str
- (Computed) The etag of the IAM policy.
- id str
- The provider-assigned unique ID for this managed resource.
- policy_data str
- (Required only by gcp.secretmanager.SecretIamPolicy) The policy data generated by agcp.organizations.getIAMPolicydata source.
- project str
- secret_id str
- etag String
- (Computed) The etag of the IAM policy.
- id String
- The provider-assigned unique ID for this managed resource.
- policyData String
- (Required only by gcp.secretmanager.SecretIamPolicy) The policy data generated by agcp.organizations.getIAMPolicydata source.
- project String
- secretId String
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the google-betaTerraform Provider.