liveBook · Manning

Role

As explained in Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform

An access-control role is a named collection of permissions that can be assigned to an identity or service account.

A role is a named collection of permissions assigned to a user or service account. Grouping permissions into roles makes access composable: teams can add or remove a defined access set as infrastructure changes. section 8.1.1

Use roles to enforce least privilege by granting only the access required for a task. A delivery pipeline might manage network, application, and database resources without receiving broader administrative access. section 8.1.1

Extract project-level roles from a monolithic infrastructure configuration without disrupting live access:

  • Copy the IAM configuration into a separate directory or repository. section 10.2.1
  • Initialize the new infrastructure state and import the existing roles and service accounts rather than recreating them. section 10.2.1
  • Run a plan or dry run and verify that the separated configuration produces no changes. section 10.2.1
  • Remove the role configuration from the monolith’s state and code only after the separated configuration matches live infrastructure. section 10.2.1

Frontend pipeline roles

A frontend delivery pipeline receives roles/compute.networkAdmin, roles/appengine.appAdmin, and roles/cloudsql.admin. These permissions allow network, application, and database administration while excluding unrelated resource types. section 8.1.1

Figure 10.5 The sundew system’s IAM policies for the GCP project have no dependencies, and you can easily refactor them without disrupting other infrastructure.

Shows why IAM policies with no resource dependencies can be separated first during infrastructure refactoring. section 10.2.1

How Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform covers it

How deep it goes
Explains permission grouping and demonstrates extraction, state import, verification, and removal, but does not detail role internals.
Examples
Uses GCP project IAM extraction and a frontend pipeline limited to network, application, and Cloud SQL roles.
What it assumes
Assumes familiarity with infrastructure configuration, IAM resources, and deployment plans; teaches permission grouping and state-safe extraction.
What you can do after
Operate/configure role-based access by composing minimum permission sets and safely importing existing IAM resources into separated Terraform state.
How it connects
Connects roles with IAM, permissions, service accounts, least privilege, infrastructure as code, Terraform, and configuration refactoring.

Also explained in

Compare how 11 books explain role →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform. The section links point to the parts of the book it draws on.