Terraform Interview Questions Hindi mein

Terraform कोर्स के 25 सवाल, हर सवाल के सही जवाब और explanation के साथ। जवाब देखने से पहले ख़ुद सोचें।

Infrastructure as Code With Terraform

1. What does "declarative" mean for Terraform?

  1. Changes are made only by clicking
  2. You write each API call in order
  3. You describe the desired end state and Terraform works out the steps
  4. It only reads infrastructure
जवाब देखें

जवाब: You describe the desired end state and Terraform works out the steps

Desired state in, plan out.

पाठ: Why Infrastructure as Code

2. Which command shows proposed changes without making them?

  1. terraform plan
  2. terraform apply -auto-approve
  3. terraform destroy
  4. terraform init only
जवाब देखें

जवाब: terraform plan

Plan before apply.

पाठ: init, plan, apply

3. What does the version constraint ~> 2.5 allow?

  1. Only versions below 2.5
  2. Exactly 2.5 only
  3. Any version
  4. Versions 2.5 and above but below 3.0
जवाब देखें

जवाब: Versions 2.5 and above but below 3.0

Pessimistic constraint operator.

पाठ: Providers and Version Constraints

The Configuration Language

4. What is the address of resource "local_file" "config"?

  1. config.local_file
  2. local_file.config
  3. local_file/config
  4. resource.config
जवाब देखें

जवाब: local_file.config

type.name

पाठ: Resources and Their Arguments

5. When does a variable validation rule run?

  1. After apply
  2. At plan time, before any infrastructure change
  3. Only in the cloud console
  4. Never automatically
जवाब देखें

जवाब: At plan time, before any infrastructure change

Fail fast on bad input.

पाठ: Variables and Validation

6. Why did the second plan show no changes?

  1. Outputs block changes
  2. The plan failed
  3. Terraform forgot the resource
  4. Real infrastructure already matched the configuration
जवाब देखें

जवाब: Real infrastructure already matched the configuration

Applying the same config twice is idempotent.

पाठ: Locals and Outputs

7. What does cidrsubnet("10.0.0.0/16", 8, 2) return?

  1. "10.0.2.0/24"
  2. "10.0.0.0/8"
  3. "10.2.0.0/16"
  4. "10.0.0.2/32"
जवाब देखें

जवाब: "10.0.2.0/24"

Adds 8 bits to the prefix and picks network number 2.

पाठ: Expressions and Functions

Reading Plans

8. Which symbol in a plan means destroy and re-create?

  1. ~
  2. +
  3. -/+
  4. <=
जवाब देखें

जवाब: -/+

Replacement can cause downtime.

पाठ: Anatomy of a Plan

9. What does "# forces replacement" mean next to an argument?

  1. The argument is invalid
  2. It will be updated in place
  3. Changing it requires destroying and re-creating the resource
  4. Terraform will ignore it
जवाब देखें

जवाब: Changing it requires destroying and re-creating the resource

Read these before approving.

पाठ: Updates Versus Replacements

10. Why apply a saved plan file in CI?

  1. It applies exactly what was reviewed and fails if state changed meanwhile
  2. It is faster to type
  3. It skips providers
  4. It deletes the state
जवाब देखें

जवाब: It applies exactly what was reviewed and fails if state changed meanwhile

Review and apply the same thing.

पाठ: Saved Plans and JSON Output

State and Drift

11. What does Terraform state record?

  1. User passwords for the console only
  2. Only the provider version
  3. The Git history
  4. Which real resources correspond to each resource in the configuration, with their attributes
जवाब देखें

जवाब: Which real resources correspond to each resource in the configuration, with their attributes

State is the mapping layer.

पाठ: What State Is and How to Inspect It

12. What should you do when a plan shows drift from a deliberate manual change?

  1. Ignore it forever
  2. Update the configuration to match, so Terraform does not revert it
  3. Delete the state file
  4. Disable plans
जवाब देखें

जवाब: Update the configuration to match, so Terraform does not revert it

Code must remain the source of truth.

पाठ: Drift

13. Why does remote state need locking?

  1. To make plans faster
  2. To stop two people or pipelines applying changes at the same time
  3. To hide outputs
  4. Locking deletes old versions
जवाब देखें

जवाब: To stop two people or pipelines applying changes at the same time

Concurrent applies corrupt state.

पाठ: Remote State, Locking and Workspaces

Multiple Resources and Modules

14. Why is for_each usually safer than count for named items?

  1. for_each never destroys anything
  2. for_each is faster to type
  3. count cannot create resources
  4. Removing one item affects only that key instead of shifting indexes
जवाब देखें

जवाब: Removing one item affects only that key instead of shifting indexes

Stable addresses prevent accidental churn.

पाठ: count Versus for_each

15. What is the state address of the resource inside module "web"?

  1. module.web.local_file.this
  2. local_file.web
  3. web.local_file
  4. module.local_file.web
जवाब देखें

जवाब: module.web.local_file.this

Module resources are prefixed with `module.<name>`.

पाठ: Modules

16. Why pin module versions?

  1. Unpinned modules cannot be used
  2. Pinning makes modules free
  3. So upgrades happen deliberately after review, not silently
  4. Versions are only for providers
जवाब देखें

जवाब: So upgrades happen deliberately after review, not silently

Reproducible builds need pinned inputs.

पाठ: Module Sources and Versions

Secrets and Safety Rails

17. Does marking an output sensitive keep the value out of the state file?

  1. Yes, it is encrypted automatically in local state
  2. Yes, it is removed from state
  3. No, state still stores it in plain text, so the state must be protected
  4. Sensitive values are never generated
जवाब देखें

जवाब: No, state still stores it in plain text, so the state must be protected

Redaction is not encryption.

पाठ: Sensitive Values

18. Where should a database password NOT be stored?

  1. In a committed .tf or .tfvars file
  2. In a secrets manager
  3. In an encrypted, access-controlled state backend if unavoidable
  4. In an environment variable on the CI runner for the run
जवाब देखें

जवाब: In a committed .tf or .tfvars file

Never commit secrets.

पाठ: Keeping Secrets Out of Code and Safe in State

19. What does ignore_changes do?

  1. Prevents all updates to every resource
  2. Deletes the resource
  3. Hides the resource from state
  4. Stops Terraform reverting specified attributes changed outside Terraform
जवाब देखें

जवाब: Stops Terraform reverting specified attributes changed outside Terraform

Use it for attributes managed by other systems.

पाठ: prevent_destroy and Other Lifecycle Rules

Refactoring and Importing

20. What does a moved block prevent?

  1. All future changes
  2. Destroying and re-creating a resource just because its address changed
  3. Provider upgrades
  4. Variable validation
जवाब देखें

जवाब: Destroying and re-creating a resource just because its address changed

Refactor code, not infrastructure.

पाठ: Renaming With moved Blocks

21. Renaming a resource without moved leads to what plan?

  1. No changes
  2. Destroy the old address and create the new one
  3. An in-place update
  4. An error that blocks all plans
जवाब देखें

जवाब: Destroy the old address and create the new one

Addresses identify resources.

पाठ: What Happens Without moved

22. What does an import block do?

  1. Downloads a module
  2. Creates a new copy of the resource
  3. Deletes the resource
  4. Adopts an existing real resource into Terraform state at a given address
जवाब देखें

जवाब: Adopts an existing real resource into Terraform state at a given address

Bring existing infrastructure under management.

पाठ: Importing Existing Resources

Code Quality and Team Workflows

23. What does terraform validate check?

  1. Syntax, references and arguments against provider schemas, without calling cloud APIs
  2. Whether resources exist in the cloud
  3. Costs
  4. Who wrote the code
जवाब देखें

जवाब: Syntax, references and arguments against provider schemas, without calling cloud APIs

Cheap correctness checks.

पाठ: fmt and validate

24. Why apply from CI rather than from developer laptops?

  1. CI is always faster
  2. Laptops cannot run Terraform
  3. Changes get a reviewed plan, consistent tooling and an audit trail
  4. It removes the need for state
जवाब देखें

जवाब: Changes get a reviewed plan, consistent tooling and an audit trail

Process makes infrastructure changes safe.

पाठ: Plan-Based Review in CI

25. Which item belongs on a Terraform review checklist?

  1. Applying from laptops without a plan
  2. Secrets committed in terraform.tfvars
  3. Every destroy or replacement in the plan is understood and intended
  4. Unpinned provider versions
जवाब देखें

जवाब: Every destroy or replacement in the plan is understood and intended

Read the plan; pin; protect.

पाठ: A Terraform Review Checklist

← कोर्स पर वापस जाएँ