Skip to content

[DevOps] Setup Multi-Cloud Infrastructure with Terraform (Oracle Cloud, Firebase, Cloudflare) #922

@choden-dev

Description

@choden-dev

Setup Multi-Cloud Infrastructure with Terraform (Oracle Cloud, Firebase, Cloudflare)

Objective

Set up and manage infrastructure across multiple cloud providers using Terraform:

  • 2x Oracle Cloud Infrastructure (OCI) Always Free VM instances
  • Google Firebase (Firestore and Cloud Storage)
  • Cloudflare DNS and CDN services

Requirements

Oracle Cloud Infrastructure

  • 2x AMD-based Compute VM.Standard.E2.1.Micro instances
  • Virtual Cloud Network (VCN)
  • Subnet configuration
  • Security lists and rules
  • SSH key pairs for instance access

Google Firebase

  • Firestore database
  • Cloud Storage bucket
  • Required IAM roles and permissions
  • Service account configuration

Cloudflare

  • DNS zone configuration
  • CDN rules
  • SSL/TLS settings
  • Page rules (if needed)

Technical Tasks

  1. Provider Configuration

    • Set up Terraform provider for OCI
    • Set up Terraform provider for Google Cloud (Firebase)
    • Set up Terraform provider for Cloudflare
    • Configure authentication for each provider
  2. Oracle Cloud Setup

    • Create VCN and subnet resources
    • Configure security lists
    • Create compute instances
    • Configure networking and routing
    • Set up instance metadata and cloud-init scripts
  3. Firebase Setup

    • Enable required APIs
    • Create Firestore database
    • Configure Cloud Storage bucket
    • Set up IAM roles and permissions
    • Configure CORS and security rules
  4. Cloudflare Setup

    • Configure DNS zone
    • Set up SSL/TLS settings
    • Configure CDN rules
    • Set up page rules if needed
  5. Documentation

    • Document provider configurations
    • Create README with setup instructions
    • Document variables and their purposes
    • Add usage examples
    • Include troubleshooting guide

Directory Structure

terraform/
├── main.tf
├── variables.tf
├── outputs.tf
├── providers.tf
├── modules/
│   ├── oci/
│   ├── firebase/
│   └── cloudflare/
└── environments/
    ├── dev/
    └── prod/

Additional Considerations

Security

  • Use of sensitive variables
  • Implementation of least privilege principle
  • Secure storage of credentials
  • Network security best practices

Cost Management

  • Ensure OCI instances stay within Always Free tier limits
  • Monitor Firebase usage
  • Set up cost alerts where applicable

Maintenance

  • State file backup strategy
  • Version control best practices
  • Documentation update process

Acceptance Criteria

  1. All infrastructure can be created using terraform apply
  2. Resources are properly tagged and labeled
  3. Security best practices are implemented
  4. Documentation is complete and accurate
  5. Infrastructure can be destroyed cleanly using terraform destroy

Resources

Notes

  • Remember to use terraform workspaces or separate state files for different environments
  • Consider using remote state storage
  • Implement proper state locking mechanisms
  • Use consistent naming conventions across all resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    devopsAnything to do with development operations

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions