XK0-006 practice question 13 of 15

A Linux administrator wants to use AI to deploy infrastructure as code. Which of the following is a best practice regarding the use of AI for this task?

Full set: 149 questions
Answer options
A: Using copy and paste when possible
B: Generating monolithic code
C: Linting generated code Correct answer
D: Merging CI/CD pipelines
Correct Answer:
C. Linting generated code
Explanation

When using Artificial Intelligence (AI) to generate Infrastructure as Code (IaC), the output must be treated as code written by a junior developer—it requires rigorous validation. Linting is an automated process that checks code for programmatic and stylistic errors, adherence to conventions, and potential bugs. Applying a linter to AI-generated IaC is a crucial best practice. It ensures the code meets quality standards, is syntactically correct, and follows established patterns before it is committed to a repository or used in a deployment pipeline, thereby reducing the risk of errors and security vulnerabilities.

Why Incorrect

A. Using copy and paste is generally discouraged as it leads to code duplication and maintenance challenges, regardless of the code's origin.
B. Generating monolithic code is an anti-pattern. Best practices for IaC, as with most software, favor modular, reusable, and maintainable components.
D. Merging CI/CD pipelines is not a practice related to code generation. Integrating IaC into a CI/CD pipeline is a goal, not a method for ensuring code quality.

References

1. Forsgren

N.

Humble

J.

& Kim

G. (2018). Accelerate: The Science of Lean Software and DevOps: Building and Scaling High Performing Technology Organizations. IT Revolution Press. Chapter 4 discusses the importance of automated testing and code quality checks as foundational DevOps practices

which apply directly to IaC.

2. Google Cloud. (2023). DevOps tech: Infrastructure as code. Google Cloud Architecture Center. This document emphasizes that IaC should be versioned

tested

and validated

practices which include linting.

3. Amershi

S.

et al. (2019). Software Engineering for Machine Learning: A Case Study. In Proceedings of the 41st International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP '19). IEEE Press

291–300. https://doi.org/10.1109/ICSE-SEIP.2019.00042. This paper highlights the need for rigorous software engineering practices

including code quality checks

when dealing with AI/ML systems and their outputs.

Scroll to Top