DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Platform Engineering Trends in Cloud-Native: Q&A With Ville Aikas
  • Comparing Cloud Hosting vs. Self Hosting
  • Dynatrace Perform: Day Two
  • How To Reduce the Impact of a Cloud Outage

Trending

  • Master-Class: Understanding Database Replication (Single, Multi, and Leaderless)
  • Solving the Mystery: Why Java RSS Grows in Docker on M1 Macs
  • Building Production-Grade GenAI on GCP with Vertex AI Agent Builder
  • A Walk-Through of the DZone Article Editor
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Infrastructure as Code (IaC) in a Multi-Cloud Environment: Consistency and Security Issues

Infrastructure as Code (IaC) in a Multi-Cloud Environment: Consistency and Security Issues

IaC streamlines multi-cloud and DevOps with automation, but challenges like drift, fragmentation, leaks, and weak encryption remain.

By 
Olha Krasnozhon user avatar
Olha Krasnozhon
·
Oct. 02, 25 · Analysis
Likes (1)
Comment
Save
Tweet
Share
3.8K Views

Join the DZone community and get the full member experience.

Join For Free

Relevance of the Study

Modern organizations are increasingly turning to cloud technologies to improve the flexibility, scalability, and efficiency of their IT infrastructure. One important tool in this process is Infrastructure as Code (IaC), which allows organizations to describe their infrastructure using code, automate the deployment process, reduce the risk of human error, and ensure consistency across different stages of the application lifecycle.

In addition, there is a trend towards multi-cloud architectures, where companies use multiple cloud providers to spread the load, improve fault tolerance, and comply with security and data localization regulations. This approach allows organizations to take advantage of the benefits of different cloud providers while minimizing the risks associated with a single provider.

However, combining Infrastructure as Code (IaC) with a multi-cloud strategy presents new challenges, particularly related to consistency and security. Each cloud platform has its own unique characteristics, including differences in APIs, configuration formats, access rights models, and resource management approaches. These differences make it challenging to maintain a unified and consistent infrastructure across all platforms.

Configuration drift, errors in applying IaC templates, and fragmented access policies can lead to increased vulnerabilities and incidents. Additionally, the use of IaC introduces additional risks associated with storing sensitive information in code and potential unauthorized access and attacks on the software supply chain.

At the same time, the market for solutions offers a variety of tools designed to enhance the security and reliability of IaC. These include static configuration analysis tools, version control systems, centralized secret management platforms, and DevSecOps and policy-as-code practices. However, no single approach can guarantee the security and consistency of an infrastructure in all cloud environments simultaneously, especially in situations where changes are frequent and development occurs at a high pace.

Purpose of the Study

The aim of this research is to identify and analyze the main challenges associated with using IaC in a multi-cloud setting, as well as to provide recommendations for ensuring consistency and security in IaC implementation within a distributed cloud environment.

Materials and Research Methods

The research is based on an analysis of scientific publications, reports from industry vendors, and documentation from open IaC tools such as Terraform, Pulumi, Ansible, and AWS CloudFormation. We used methods of comparative analysis of solutions, systematic identification of threats and configuration errors, and statistical data from research companies. The study employs methods of content analysis, table comparison, logical and structural interpretation, and expert assessment synthesis.

Results

Infrastructure as Code (IaC) is the practice of managing and deploying IT infrastructure using machine-readable configuration files, rather than manual or interactive tools. This allows the infrastructure to be versioned, automated, and reproduced in a similar way to program code.

IaC uses two main approaches: declarative, which describes the desired state of the infrastructure without specifying how to achieve it, and imperative, which provides instructions for specific steps. The declarative approach is more common, as it simplifies automation and aligns with modern DevOps principles.

The figure below illustrates a typical workflow for implementing the IaC concept. The process starts with the user or developer writing infrastructure code, which is then saved in a version control system such as Git. Next, there is an exchange between the repository and an automation server, like a continuous integration and continuous deployment (CI/CD) or IaC tool, using the push/pull model. The resulting code is used to manage both cloud infrastructure and on-premises infrastructure via an API or automation server. This approach ensures the reproducibility, control of changes, and automation of infrastructure management [5].

Diagram of the basic workflow Infrastructure as Code

Fig. Diagram of the basic workflow Infrastructure as Code [5] (Image credit: Karl Paulsen)


The principles of DevOps and continuous integration and continuous delivery (CI/CD) practices are integrated into the IaC. Infrastructure configurations are stored in a version control system (VCS). Changes are automatically tested and applied to the application through a pipeline. Automation tools monitor deviations (configuration drift). At the same time, a Git repository serves as the single source of truth. GitOps models complement IaC by providing a repository as a control point and launching CI/CD pipelines for infrastructure.

The transition to multi-cloud architectures emphasizes the importance of consistency and standardization in IaC. According to the ISO/IEC 22123-1 standard, a multi-cloud environment involves the use of two or more cloud service providers, such as AWS, Azure, and Google Cloud Platform (GCP). This approach helps reduce dependency on a single vendor and increases fault tolerance, but it also introduces challenges in ensuring consistency across configurations and access management.

Differences in APIs, formats, terminology, and identification models can lead to fragmentation and state drift, which can be challenging to manage. Within this context, the concept of "immutable infrastructure" stands out. Instead of making changes to existing resources, this approach involves rebuilding the entire infrastructure from scratch with each change, eliminating the accumulation of configuration drift. This practice improves reliability and reproducibility, particularly in a multi-cloud environment where Terraform, continuous integration/continuous delivery (CI/CD), and modular IaC are used for management.

Evaluation methodologies are being developed to ensure the quality of IaC code. For example, there is a framework for assessing the quality of Ansible IaC scripts based on the ISO/IEC 25010 standard. This framework allows for the systematic analysis of the reliability and security of infrastructure code, as well as the identification of problems related to structuring, error management, and secrets.

In addition, modern IaC security approaches include the use of templates that map to real cloud resources in order to detect inconsistencies. Tools like Microsoft Defender for Cloud can help ensure that IaC templates accurately reflect real-world settings, preventing drift and vulnerabilities. Studies have shown that the most commonly implemented security practices involve controlling IAM policies, while encryption and data protection at rest are less frequently implemented.

The transition of organizations to multi-cloud strategies has led to a significant increase in the complexity of infrastructure management. According to HashiCorp, approximately 90% of companies are using multi-cloud solutions, and many of them are faced with the challenge of coordinating configurations between AWS, Azure, and GCP, as well as other platforms.

Despite the widespread use of IaC — up to 89% of implementations — only about 6% of projects have achieved full automation and coverage of infrastructure with code. This leaves many resources outside the control of code, creating a challenge for organizations looking to optimize their infrastructure management processes [4].

The main issue is configuration drift, which refers to the difference between the actual state of an infrastructure and the desired state defined in its IaC files. This can happen due to manual changes made by administrators, automatic updates from cloud services, or inconsistencies in Terraform state files. Often, changes made in the cloud console are not reflected in the code, violating the GitOps model of a single source of truth and the standard CI/CD process.

In a multi-cloud environment, there are additional risks. Different APIs, configuration files, and identity management systems can lead to fragmentation and incompatibility, making it difficult to use common IaC components. This also prevents the migration of templates between providers and causes configuration differences depending on the environment. Reports emphasize the importance of modular architecture, version control, and automated testing to ensure consistency across clouds.

There are rare cases where drifts are completely controlled: less than a third of companies continuously monitor for drift, and most only respond after the fact when incidents have occurred. This means errors are not detected quickly enough, which poses a threat to the security and stability of services.

Table 1 summarizes the key issues:

Academic research confirms that configuration issues are the most common type of defect. This is significantly more than with regular program code. A recent study on multi-cloud systems has revealed additional risks, such as API inconsistencies, differing security policies, and difficulty managing unified management across all cloud environments [2].

Some advanced projects use AI models to detect drift: work is indicated where deviations between the runtime state and the IaC database are detected based on trained models. This approach speeds up diagnostics and allows you to proactively eliminate inconsistencies.

Modern research and reports emphasize that the implementation of IaC greatly simplifies and accelerates the deployment of infrastructure, but at the same time generates specific threats. According to the research, 83% of organizations found hard-coded credentials in version control systems, and 85% in user data of virtual machines; confidential data was present in 66% of storage systems and in 63% of open buckets. These practices contribute to the leakage of secrets and weak data protection [3].

Static analysis of IaC scripts reveals frequently recurring security issues, which indicate potential weaknesses in the security of the code. The GLITCH study identified these "smells" in Ansible and Chef, analyzing tens of thousands of scripts, and offered a universal detection framework that demonstrated high accuracy in the analysis [1].

According to research, 82% of enterprises have experienced security incidents due to configuration errors in the cloud, while up to 31% of these incidents are directly related to incorrect IaC settings. This emphasizes the need for a systematic approach to infrastructure code validation.

The National Security Agency's (NSA) Cloud Security Standard highlights IaC as a key strategy for automated and secure deployment. By using Policy-as-Code and automating deployments, you can quickly identify unauthorized changes and ensure that your infrastructure is secure.

Thus, the totality of modern sources demonstrates that the main security concerns of IaC revolve around:

  • leaks of secrets and credentials;
  • malicious or outdated templates;
  • lack of widely accepted data encryption practices;
  • errors in IAM and RBAC configurations;
  • weak integration of static analysis and artifact signatures

Table 2 provides an overview of the key characteristics of popular IaC solutions. These include the level of support for multi-cloud architectures, the syntax or description language used, and their features and limitations, which affect the choice of tool when implementing DevOps strategies.

Research shows that Terraform continues to be the preferred tool for managing multi-cloud environments, while Pulumi is slowly gaining popularity among developers who focus on language integration. Additionally, specialized management and security platforms work in conjunction with the main IaC tools to provide automated control, policy compliance, and enhanced governance for distributed infrastructure.

Recommendations

To ensure the reliability and stability of IaC in a multi-cloud environment, we recommend the following:

  1. Using provider-independent tools like Terraform and Pulumi with modular architecture and reusability patterns.
  2. Centralized storage of configuration files in version control systems like Git using the GitOps approach.
  3. Implementation of Policy-as-Code and DevOps security practices to automatically validate security policies and ensure compliance with regulatory standards at the continuous integration and continuous delivery (CI/CD) stage.
  4. Monitoring for configuration drift using automated scanning tools and infrastructure health checks.
  5. Managing secrets centrally with solutions like Vault or AWS Secrets Manager, avoiding hardcoding sensitive information.
  6. Regular static analysis of IaC code with tools like Checkov, tfsec, and Terrascan to identify potential vulnerabilities.
  7. Standardizing IAM (identity and access management) and RBAC (role-based access control) policies for different cloud providers based on the principle of least privilege.
  8. Document architectural patterns and processes for IaC to increase transparency and simplify maintenance in a multi-cloud environment.

Future research may focus on developing universal models to ensure the consistency of IaC in multi-cloud systems. It may also aim to create adaptive frameworks for automatically detecting and fixing configuration drift. Additionally, it can integrate artificial intelligence to perform predictive vulnerability analysis on IaC. Furthermore, it might expand methods for formally verifying the security of IaC templates. Finally, it could investigate practices for managing access policies and secrets while considering the cross-platform features offered by cloud providers.

Conclusion

Thus, Infrastructure as Code has become an integral part of the modern DevOps ecosystem, particularly in the context of multi-cloud strategies. However, its implementation requires a systematic and integrated approach to ensure security and consistency throughout the infrastructure lifecycle.

While there is a wide range of available tools, no one solution can provide full coverage for all aspects of multi-cloud IaC. Terraform is the best choice for cross-platform operations due to its maturity and wide community support. Pulumi, on the other hand, offers flexibility and expressiveness through general-purpose languages.

Effective implementation of IaC necessitates the adoption of DevSecOps best practices, such as Policy-as-Code and automation of testing and monitoring. Regular static and dynamic analyses of IaC code are also essential. Additionally, predictive analytics should be integrated to detect configuration and architectural vulnerabilities early on.

Future research in this area should focus on developing cross-platform security standards, improving the formal verification of IaC templates, and creating intelligent systems that can adaptively prevent infrastructure failures and incidents in a multi-cloud environment.

References 

  1. GLITCH: Automated Polyglot Security Smell Detection in Infrastructure as Code [Electronic resource]. – Access mode: https://arxiv.org/abs/2205.14371
  2. How to Configure Multi-Cloud Infrastructure as Code Using Python and Terraform – Apriorit [Electronic resource]. – Access mode: https://www.apriorit.com/dev-blog/devops-how-to-configure-multi-cloud-infrastructure
  3. Infrastructure as Code (IaC): A Complete Guide [Electronic resource]. – Access mode: https://blog.codacy.com/infrastructure-as-code-iac
  4. Infrastructure as Code (IaC): Streaming Multi-Cloud Deployments [Electronic resource]. – Access mode: https://www.linkedin.com/pulse/infrastructure-code-iac-streamlining-multi-cloud-deployments-engro-7prcc.
  5. The Basics of Infrastructure as Code | TV Tech [Electronic resource]. – Access mode:https://www.tvtechnology.com/opinion/the-basics-of-infrastructure-as-code?utm_medium=organic&utm_source=yandexsmartcamera
Infrastructure Cloud security

Opinions expressed by DZone contributors are their own.

Related

  • Platform Engineering Trends in Cloud-Native: Q&A With Ville Aikas
  • Comparing Cloud Hosting vs. Self Hosting
  • Dynatrace Perform: Day Two
  • How To Reduce the Impact of a Cloud Outage

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook