Coder Social home page Coder Social logo

pulumiconfig's Introduction

PulumiConfig

Experimental Project: This project is in an experimental phase and may undergo significant changes. Use at your own risk.

GoTemplate

PulumiConfig is a Golang library designed to improve the way developers manage configuration in Pulumi. By leveraging Golang structs, it simplifies the process of tracking and validating configuration keys, ensuring a more efficient and error-free deployment process in cloud infrastructure projects.

Features

  • Seamless Integration: Effortlessly integrates with Pulumi and Golang projects.
  • Automated Key Tracking: Automatically tracks configuration keys using Golang structs.
  • JSON Tagging: Supports JSON tagging for Pulumi configuration keys, including nested structs.
  • Validation: Integrates with the Go Playground Validator for custom validation logic, allowing required values and complex validations.

Installation

To integrate PulumiConfig into your Golang project, follow these steps:

go get -u github.com/exivity/pulumiconfig

Usage

Basic Usage

import (
    "github.com/exivity/EaaS-Pulumi-Deployment/pkg/providers/config"
)

// Example of defining a PulumiConfig struct
type PulumiConfig struct {
    Name string `pulumi:"name" validate:"default=john-doe"`
}

// Example deployment function using PulumiConfig
func main() error {
    ...
    cfg := &PulumiConfig{}
    err = pulumiconfig.GetConfig(ctx, cfg, config.GetCustomValidations(ctx)...)
    ...
}

Advanced Features

  • Custom Validation Logic: Implement the Validator interface to create custom validation types. This is useful for scenarios that require specific validation rules beyond standard checks.

Example Snippets

func GetCustomValidations(ctx *pulumi.Context) []pulumiconfig.Validator {
    return []pulumiconfig.Validator{
        &MyValidator{
            pulumiconfig.FieldValidation{
                Tag:      "Register",
                Validate: Register,
            },
        },
    }
}

func Register(validate *validator.Validate) error {
    // Register custom validation logic
}

// Using type conversions in PulumiConfig
type MyConfig struct {
    MyNumber string `pulumi:"myNumber" validate:"required"`
}

Contributing

We welcome contributions! Please refer to the CODEOWNERS file for guidelines on contributing to PulumiConfig.

License

PulumiConfig is released under MIT. See the LICENSE file for more details.

pulumiconfig's People

Contributors

linuxluigi avatar renovate[bot] avatar timrab avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

pulumiconfig's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/main.yml
  • actions/checkout v4
  • actions/setup-go v5
gomod
go.mod
  • go 1.22.3
  • github.com/go-playground/validator/v10 v10.21.0
  • github.com/pulumi/pulumi/sdk/v3 v3.118.0
  • github.com/stretchr/testify v1.9.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.