1Z0-997-25 Question 27
Select 2Your organization needs to provision both development and production environments in OCI using Terraform via Oracle Resource Manager. The goal is to ensure consistent deployments for all environments while allowing each environment to have different compute shapes and other resource configurations. Which two statements represent best practices to achieve these requirements?
- A
Use separate Terraform state files for development and production, referencing environment-specific variables in a single Terraform configuration.
- B
Manually adjust the compute shapes in the development environment only after provisioning to minimize changes in the Terraform code.
- C
Maintain a single OCI compartment for both development and production environments to simplify governance and resource naming.
- D
Leverage environment variables or separate variable files to define distinct shapes and other parameters so that the same codebase can be reused for different environments.
Show answer and explanation
Correct answers: A, D
Explanation
Separating environments through distinct compartments, variable files, and state files is a common best practice in IaC. By defining parameters for each environment (such as different shapes or quotas), a single Terraform codebase remains consistent and maintainable. Refer to the Oracle Cloud Infrastructure Resource Manager documentation (https://docs.oracle.com/en-us/iaas/Content/ResourceManager/home.htm) and the Terraform Provider for OCI (https://registry.terraform.io/providers/oracle/oci/latest) for more information on recommended practices for multi-environment IaC deployments.
- A. Correct.
Option 1 (Correct): Using separate state files for dev and prod, along with environment-specific variables in a single Terraform configuration, is a recommended approach. It allows you to apply changes independently to each environment and isolates state tracking. This ensures that changes to development do not inadvertently affect production.
- B. Incorrect.
Option 2 (Incorrect): Manually adjusting shapes after provisioning defeats the purpose of IaC, which is to automate and version-control all changes. Manual intervention introduces inconsistencies, increases risk, and makes the infrastructure harder to manage over time.
- C. Incorrect.
Option 3 (Incorrect): Maintaining a single compartment for both environments is usually not a best practice. Separating dev and prod resources into different compartments helps with proper access control, billing, and managing resource quotas. Combining them can cause governance and security issues.
- D. Correct.
Option 4 (Correct): Using environment variables or separate variable/TFVar files to specify parameter differences (e.g., compute shapes) for each environment is a best practice. This approach enables you to reuse one standardized Terraform configuration across multiple environments and keep your code DRY (Don't Repeat Yourself).