1Z0-1067-25 Question 22
Select 2You are managing a multi-tier application stack that needs to be deployed across two different OCI regions for high availability. You plan to utilize Infrastructure as Code (IaC) with Terraform and Oracle Resource Manager to ensure these stacks are fully replicable. Which two actions must you take to allow repeatable deployments of the same Terraform code in both regions without manual configuration changes?
- A
A. Define the region as a variable in your Terraform configuration and pass different region values for each deployment.
- B
B. Hard-code the region name in your Terraform code to match each region� actual name exactly.
- C
C. Use Terraform modules to encapsulate repeated resource definitions, ensuring that differences can be passed in as input variables.
- D
D. Create a separate Terraform configuration file for each region and manually update resource definitions with the correct region detail.
- E
E. Reference the region from the user� OCI CLI configuration by setting TF_VAR_region in your environment.
Show answer and explanation
Correct answers: A, C
Explanation
By parameterizing region settings within Terraform and using modules for shared resource definitions, you can easily deploy the same configuration to multiple OCI regions. Relying on variables and modules ensures that minimal changes are needed for each environment, adhering to best practices outlined in the Oracle Cloud Infrastructure Resource Manager and Terraform documentation.
- A. Correct.
A. Correct. Parameterizing the region in the Terraform configuration (e.g., using a variable like var.region) lets you pass different region values easily. This avoids hard-coding and ensures replicable code.
- B. Incorrect.
B. Incorrect. Hard-coding the region leads to code duplication or complex manual changes whenever you switch ranges. This defeats the purpose of Infrastructure as Code in replicating stacks seamlessly.
- C. Correct.
C. Correct. Using modules with input variables is a best practice for common resource definitions. You can pass different values (such as region and compartment IDs) to the same module, enabling repeatable deployments across multiple environments.
- D. Incorrect.
D. Incorrect. While you can maintain separate Terraform configurations for each region, this approach increases maintenance overhead and risks inconsistencies unless carefully managed. It is not the recommended best practice for replicable deployments.
- E. Incorrect.
E. Incorrect. Although using environment variables is possible, referencing the region solely from the user� OCI CLI config is unreliable for consistent deployments. Variables within the Terraform code itself are the preferred approach for setting region values.