Configure GCP Identity-Aware Proxy IAM Policies

The gcp:iap/webTypeComputeIamPolicy:WebTypeComputeIamPolicy resource, part of the Pulumi GCP provider, controls IAM policies for Identity-Aware Proxy (IAP) protected compute resources at the project level. This guide focuses on three capabilities: authoritative policy replacement, role binding strategies for single or multiple members, and time-based access with IAM Conditions.

IAP IAM resources come in three variants with different update semantics. WebTypeComputeIamPolicy is authoritative and replaces the entire policy; it conflicts with WebTypeComputeIamBinding and WebTypeComputeIamMember. WebTypeComputeIamBinding manages all members for a specific role, while WebTypeComputeIamMember adds individual members incrementally. The examples are intentionally small. Combine them with your own project configuration and member lists.

Replace the entire IAM policy authoritatively

When you need complete control over IAP access, WebTypeComputeIamPolicy replaces the entire policy in one operation, removing any bindings not declared in your configuration.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const admin = gcp.organizations.getIAMPolicy({
    bindings: [{
        role: "roles/iap.httpsResourceAccessor",
        members: ["user:jane@example.com"],
    }],
});
const policy = new gcp.iap.WebTypeComputeIamPolicy("policy", {
    project: projectService.project,
    policyData: admin.then(admin => admin.policyData),
});
import pulumi
import pulumi_gcp as gcp

admin = gcp.organizations.get_iam_policy(bindings=[{
    "role": "roles/iap.httpsResourceAccessor",
    "members": ["user:jane@example.com"],
}])
policy = gcp.iap.WebTypeComputeIamPolicy("policy",
    project=project_service["project"],
    policy_data=admin.policy_data)
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/iap"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		admin, err := organizations.LookupIAMPolicy(ctx, &organizations.LookupIAMPolicyArgs{
			Bindings: []organizations.GetIAMPolicyBinding{
				{
					Role: "roles/iap.httpsResourceAccessor",
					Members: []string{
						"user:jane@example.com",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = iap.NewWebTypeComputeIamPolicy(ctx, "policy", &iap.WebTypeComputeIamPolicyArgs{
			Project:    pulumi.Any(projectService.Project),
			PolicyData: pulumi.String(admin.PolicyData),
		})
		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 admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
    {
        Bindings = new[]
        {
            new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
            {
                Role = "roles/iap.httpsResourceAccessor",
                Members = new[]
                {
                    "user:jane@example.com",
                },
            },
        },
    });

    var policy = new Gcp.Iap.WebTypeComputeIamPolicy("policy", new()
    {
        Project = projectService.Project,
        PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetIAMPolicyArgs;
import com.pulumi.gcp.iap.WebTypeComputeIamPolicy;
import com.pulumi.gcp.iap.WebTypeComputeIamPolicyArgs;
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 admin = OrganizationsFunctions.getIAMPolicy(GetIAMPolicyArgs.builder()
            .bindings(GetIAMPolicyBindingArgs.builder()
                .role("roles/iap.httpsResourceAccessor")
                .members("user:jane@example.com")
                .build())
            .build());

        var policy = new WebTypeComputeIamPolicy("policy", WebTypeComputeIamPolicyArgs.builder()
            .project(projectService.project())
            .policyData(admin.policyData())
            .build());

    }
}
resources:
  policy:
    type: gcp:iap:WebTypeComputeIamPolicy
    properties:
      project: ${projectService.project}
      policyData: ${admin.policyData}
variables:
  admin:
    fn::invoke:
      function: gcp:organizations:getIAMPolicy
      arguments:
        bindings:
          - role: roles/iap.httpsResourceAccessor
            members:
              - user:jane@example.com

The policyData property accepts output from getIAMPolicy, which defines role bindings and members. This resource is authoritative: it removes any existing bindings not included in policyData. The project property specifies which GCP project’s IAP compute resources to manage.

Grant a role to multiple members at once

Teams often grant the same role to several users or service accounts while preserving other role assignments in the policy.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const binding = new gcp.iap.WebTypeComputeIamBinding("binding", {
    project: projectService.project,
    role: "roles/iap.httpsResourceAccessor",
    members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp

binding = gcp.iap.WebTypeComputeIamBinding("binding",
    project=project_service["project"],
    role="roles/iap.httpsResourceAccessor",
    members=["user:jane@example.com"])
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/iap"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iap.NewWebTypeComputeIamBinding(ctx, "binding", &iap.WebTypeComputeIamBindingArgs{
			Project: pulumi.Any(projectService.Project),
			Role:    pulumi.String("roles/iap.httpsResourceAccessor"),
			Members: pulumi.StringArray{
				pulumi.String("user:jane@example.com"),
			},
		})
		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 binding = new Gcp.Iap.WebTypeComputeIamBinding("binding", new()
    {
        Project = projectService.Project,
        Role = "roles/iap.httpsResourceAccessor",
        Members = new[]
        {
            "user:jane@example.com",
        },
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.iap.WebTypeComputeIamBinding;
import com.pulumi.gcp.iap.WebTypeComputeIamBindingArgs;
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 binding = new WebTypeComputeIamBinding("binding", WebTypeComputeIamBindingArgs.builder()
            .project(projectService.project())
            .role("roles/iap.httpsResourceAccessor")
            .members("user:jane@example.com")
            .build());

    }
}
resources:
  binding:
    type: gcp:iap:WebTypeComputeIamBinding
    properties:
      project: ${projectService.project}
      role: roles/iap.httpsResourceAccessor
      members:
        - user:jane@example.com

The members array lists all identities that should have this role. WebTypeComputeIamBinding is authoritative for the specified role but preserves other roles in the policy. Member identities use the format “type:identifier” (e.g., “user:jane@example.com”, “serviceAccount:my-sa@project.iam.gserviceaccount.com”).

Add a single member to a role incrementally

When onboarding individual users, you can add them without declaring the complete member list for the role.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const member = new gcp.iap.WebTypeComputeIamMember("member", {
    project: projectService.project,
    role: "roles/iap.httpsResourceAccessor",
    member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp

member = gcp.iap.WebTypeComputeIamMember("member",
    project=project_service["project"],
    role="roles/iap.httpsResourceAccessor",
    member="user:jane@example.com")
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/iap"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iap.NewWebTypeComputeIamMember(ctx, "member", &iap.WebTypeComputeIamMemberArgs{
			Project: pulumi.Any(projectService.Project),
			Role:    pulumi.String("roles/iap.httpsResourceAccessor"),
			Member:  pulumi.String("user:jane@example.com"),
		})
		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 member = new Gcp.Iap.WebTypeComputeIamMember("member", new()
    {
        Project = projectService.Project,
        Role = "roles/iap.httpsResourceAccessor",
        Member = "user:jane@example.com",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.iap.WebTypeComputeIamMember;
import com.pulumi.gcp.iap.WebTypeComputeIamMemberArgs;
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 member = new WebTypeComputeIamMember("member", WebTypeComputeIamMemberArgs.builder()
            .project(projectService.project())
            .role("roles/iap.httpsResourceAccessor")
            .member("user:jane@example.com")
            .build());

    }
}
resources:
  member:
    type: gcp:iap:WebTypeComputeIamMember
    properties:
      project: ${projectService.project}
      role: roles/iap.httpsResourceAccessor
      member: user:jane@example.com

The member property specifies a single identity to add. WebTypeComputeIamMember is non-authoritative: it adds this member without affecting other members who already have the role. This approach works well for incremental access grants where you don’t want to manage the full member list.

Apply time-based access with IAM Conditions

Temporary access grants expire automatically when you attach IAM Conditions, reducing manual cleanup.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const admin = gcp.organizations.getIAMPolicy({
    bindings: [{
        role: "roles/iap.httpsResourceAccessor",
        members: ["user:jane@example.com"],
        condition: {
            title: "expires_after_2019_12_31",
            description: "Expiring at midnight of 2019-12-31",
            expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
        },
    }],
});
const policy = new gcp.iap.WebTypeComputeIamPolicy("policy", {
    project: projectService.project,
    policyData: admin.then(admin => admin.policyData),
});
import pulumi
import pulumi_gcp as gcp

admin = gcp.organizations.get_iam_policy(bindings=[{
    "role": "roles/iap.httpsResourceAccessor",
    "members": ["user:jane@example.com"],
    "condition": {
        "title": "expires_after_2019_12_31",
        "description": "Expiring at midnight of 2019-12-31",
        "expression": "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
    },
}])
policy = gcp.iap.WebTypeComputeIamPolicy("policy",
    project=project_service["project"],
    policy_data=admin.policy_data)
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/iap"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		admin, err := organizations.LookupIAMPolicy(ctx, &organizations.LookupIAMPolicyArgs{
			Bindings: []organizations.GetIAMPolicyBinding{
				{
					Role: "roles/iap.httpsResourceAccessor",
					Members: []string{
						"user:jane@example.com",
					},
					Condition: {
						Title:       "expires_after_2019_12_31",
						Description: pulumi.StringRef("Expiring at midnight of 2019-12-31"),
						Expression:  "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = iap.NewWebTypeComputeIamPolicy(ctx, "policy", &iap.WebTypeComputeIamPolicyArgs{
			Project:    pulumi.Any(projectService.Project),
			PolicyData: pulumi.String(admin.PolicyData),
		})
		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 admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
    {
        Bindings = new[]
        {
            new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
            {
                Role = "roles/iap.httpsResourceAccessor",
                Members = new[]
                {
                    "user:jane@example.com",
                },
                Condition = new Gcp.Organizations.Inputs.GetIAMPolicyBindingConditionInputArgs
                {
                    Title = "expires_after_2019_12_31",
                    Description = "Expiring at midnight of 2019-12-31",
                    Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
                },
            },
        },
    });

    var policy = new Gcp.Iap.WebTypeComputeIamPolicy("policy", new()
    {
        Project = projectService.Project,
        PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetIAMPolicyArgs;
import com.pulumi.gcp.iap.WebTypeComputeIamPolicy;
import com.pulumi.gcp.iap.WebTypeComputeIamPolicyArgs;
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 admin = OrganizationsFunctions.getIAMPolicy(GetIAMPolicyArgs.builder()
            .bindings(GetIAMPolicyBindingArgs.builder()
                .role("roles/iap.httpsResourceAccessor")
                .members("user:jane@example.com")
                .condition(GetIAMPolicyBindingConditionArgs.builder()
                    .title("expires_after_2019_12_31")
                    .description("Expiring at midnight of 2019-12-31")
                    .expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
                    .build())
                .build())
            .build());

        var policy = new WebTypeComputeIamPolicy("policy", WebTypeComputeIamPolicyArgs.builder()
            .project(projectService.project())
            .policyData(admin.policyData())
            .build());

    }
}
resources:
  policy:
    type: gcp:iap:WebTypeComputeIamPolicy
    properties:
      project: ${projectService.project}
      policyData: ${admin.policyData}
variables:
  admin:
    fn::invoke:
      function: gcp:organizations:getIAMPolicy
      arguments:
        bindings:
          - role: roles/iap.httpsResourceAccessor
            members:
              - user:jane@example.com
            condition:
              title: expires_after_2019_12_31
              description: Expiring at midnight of 2019-12-31
              expression: request.time < timestamp("2020-01-01T00:00:00Z")

IAM Conditions add temporal or contextual constraints to policy bindings. The condition block requires a title, optional description, and a CEL expression. Here, the expression checks request.time against a timestamp, automatically revoking access after the specified date. Conditions work with all three IAM resource types (Policy, Binding, Member).

Beyond these examples

These snippets focus on specific IAM policy features: authoritative vs incremental policy management, role binding to single or multiple members, and time-based access with IAM Conditions. They’re intentionally minimal rather than complete access control configurations.

The examples reference pre-existing infrastructure such as a GCP project with IAP enabled for compute resources, and projectService.project references. They focus on policy configuration rather than provisioning IAP itself.

To keep things focused, common IAM patterns are omitted, including:

  • Policy conflict resolution between resource types
  • Custom role definitions and management
  • Audit logging for policy changes
  • Service account impersonation patterns

These omissions are intentional: the goal is to illustrate how each IAM resource type manages access, not provide drop-in security modules. See the WebTypeComputeIamPolicy resource reference for all available configuration options.

Let's configure GCP Identity-Aware Proxy IAM Policies

Get started with Pulumi Cloud, then follow our quick setup guide to deploy this infrastructure.

Try Pulumi Cloud for FREE

Frequently Asked Questions

Resource Selection & Conflicts
What's the difference between Policy, Binding, and Member resources?
WebTypeComputeIamPolicy is authoritative and replaces the entire IAM policy. WebTypeComputeIamBinding is authoritative for a specific role, preserving other roles. WebTypeComputeIamMember is non-authoritative, adding individual members while preserving existing ones.
Which IAM resources can I use together?
You cannot use WebTypeComputeIamPolicy with WebTypeComputeIamBinding or WebTypeComputeIamMember, as they will conflict. However, you can use WebTypeComputeIamBinding and WebTypeComputeIamMember together, but only if they don’t grant privileges to the same role.
Why am I seeing policy conflicts or unexpected changes?
Mixing WebTypeComputeIamPolicy with WebTypeComputeIamBinding or WebTypeComputeIamMember causes them to fight over policy control. Use Policy alone for full control, or use Binding/Member together for granular management.
IAM Conditions
How do I add time-based or conditional access?
Add a condition block with title, description, and expression. For example, to expire access: expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")".
Are there limitations with IAM Conditions?
Yes, IAM Conditions have known limitations. Review the GCP documentation on IAM Conditions limitations if you encounter issues.
Configuration
What happens if I don't specify a project?
The project is parsed from the parent resource identifier. If unavailable there, the provider’s default project is used.

Using a different cloud?

Explore security guides for other cloud providers: