liveBook · Manning

Service account

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

A service account is a non-human identity used by software or automated processes to authenticate and access resources.

A service account is a non-human identity that software or automated processes use to authenticate and access resources. Its permissions should match the application’s actual access path, including intermediary services such as database proxies. section 11.2.1 section 11.2.2

Use service-account configuration as an operational boundary for infrastructure management and troubleshooting:

  • Extract project-level IAM service accounts and roles from a monolithic IaC configuration by copying the configuration, initializing separate state, importing existing resources, verifying an unchanged plan, and then removing the originals. section 10.2.1
  • Check configuration drift before diagnosing a failure; compare the declared permissions with the active service-account policy, then investigate whether any difference affects functionality. section 11.2.1
  • Trace dependencies between the service account and consuming resources, checking that expected relationships match production behavior. section 11.2.2

Database access through a proxy

The promotions server uses a service account with roles/cloudsql.admin. Although the application appears to connect to localhost, the Cloud SQL Auth proxy uses the service account to authenticate and access the database. The account therefore needs database permissions even when application code contains no database credentials. section 11.2.2 section 11.2.1

Figure 11.6 The promotions application accesses the database through a proxy, which needs a service account with database permissions.

Shows how a proxy-mediated database connection makes the server’s service-account permissions necessary. section 11.2.2

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

How deep it goes
Traces permissions, configuration drift, resource dependencies, state imports, and safe IaC extraction without detailing identity internals.
Examples
Uses GCP project IAM, a promotions service account, Cloud SQL Auth proxy access, Terraform state import, and drift checks.
What you can do after
Diagnose service-account failures, verify effective permissions, trace dependencies, and refactor managed IAM resources without disrupting live infrastructure.
How it connects
Connects service accounts with IAM, infrastructure as code, configuration drift, resource dependencies, and database proxies.

Also explained in

Compare how 10 books explain service account →

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.