CDM Infrastructure Automation & Configuration Management 4 — Questions and Answers
Question 1: What does the `terraform import` command do?
- Downloads provider plugins required by the configuration
- Brings an existing real-world resource under Terraform state management without recreating it (Correct answer)
- Imports a Terraform module from the public registry
- Migrates a Terraform workspace to a different backend
Correct answer: Brings an existing real-world resource under Terraform state management without recreating it
`terraform import` maps an already-existing infrastructure resource to a Terraform resource block, adding it to state so Terraform can manage it going forward.
Question 2: In Kubernetes-based infrastructure automation, what is the role of a Helm chart?
- A Kubernetes RBAC policy for restricting cluster-admin access
- A packaged collection of Kubernetes manifests with templating support for repeatable application deployment (Correct answer)
- A monitoring dashboard preconfigured for Kubernetes cluster metrics
- A network policy definition file for pod-to-pod communication rules
Correct answer: A packaged collection of Kubernetes manifests with templating support for repeatable application deployment
A Helm chart bundles Kubernetes YAML manifests with Go templates, enabling parameterized and versioned application deployments.
Question 3: Which Ansible inventory feature allows you to dynamically generate host lists from cloud provider APIs?
- Static inventory files
- Dynamic inventory scripts or plugins (Correct answer)
- Ansible Tower job templates
- The `add_host` module within a playbook
Correct answer: Dynamic inventory scripts or plugins
Dynamic inventory plugins (e.g., `aws_ec2`, `azure_rm`) query cloud APIs at runtime to build the host list, eliminating the need for manually maintained static files.
Question 4: What is a key advantage of using Terraform modules?
- They allow Terraform to run without a provider configuration
- They enable reuse of infrastructure patterns across projects and reduce code duplication (Correct answer)
- They bypass the need for a remote state backend
- They automatically generate compliance reports for provisioned resources
Correct answer: They enable reuse of infrastructure patterns across projects and reduce code duplication
Terraform modules encapsulate reusable infrastructure patterns, allowing teams to standardize configurations and share them across environments or organizations.
Question 5: In a GitOps workflow, what serves as the single source of truth for infrastructure state?
- The live cloud provider console
- A Git repository containing declarative configuration files (Correct answer)
- The CI/CD pipeline's artifact registry
- An agent running on each managed node
Correct answer: A Git repository containing declarative configuration files
GitOps treats the Git repository as the authoritative desired state, using automated reconciliation to ensure running infrastructure matches what is committed.
Question 6: Which Puppet concept defines the desired final state of a system resource rather than the steps to achieve it?
- Procedural scripting
- Declarative resource definition (Correct answer)
- Imperative task execution
- Event-driven remediation
Correct answer: Declarative resource definition
Puppet uses a declarative model where you describe the desired state of resources (files, packages, services) and the agent determines how to converge to that state.
Question 7: What problem does 'idempotency' solve in infrastructure automation?
- It ensures configuration changes are rolled back on failure
- It guarantees that running the same automation multiple times produces the same result without unintended side effects (Correct answer)
- It prevents two operators from applying conflicting changes simultaneously
- It validates that all resource dependencies are resolved before provisioning begins
Correct answer: It guarantees that running the same automation multiple times produces the same result without unintended side effects
Idempotency means repeated executions of a playbook or configuration run converge to the same desired state rather than stacking duplicate changes.
What does the `terraform import` command do?