Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marshal/unmarshal complex config as JSON. #250

Merged
merged 2 commits into from
Sep 7, 2018
Merged

Conversation

pgavlin
Copy link
Member

@pgavlin pgavlin commented Sep 6, 2018

Terraform providers accept complex (i.e. non-string) config. As it
stands, we require that all provider configuration values are strings,
which causes an unfortunate inability to use these complex configuration
values. These changes enable the use of complex configuration by
serializing and deserializing complex config values using JSON.

Note that this creates a compat issue for future changes to enable
actual rich configuration in the RPC interface; such a future change
will need to accept rich values or strings for top-level properties.

Fixes #48.

Terraform providers accept complex (i.e. non-string) config. As it
stands, we require that all provider configuration values are strings,
which causes an unfortunate inability to use these complex configuration
values. These changes enable the use of complex configuration by
serializing and deserializing complex config values using JSON.

Note that this creates a compat issue for future changes to enable
actual rich configuration in the RPC interface; such a future change
will need to accept rich values _or_ strings for top-level properties.

Fixes #48.
@pgavlin
Copy link
Member Author

pgavlin commented Sep 6, 2018

When using first-class providers, this looks nice:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const testing = new aws.Provider("testing", {
    region: aws.config.region,
    assumeRole: {
        roleArn: "<redacted>",
    },
});

const staging = new aws.Provider("staging", {
    region: aws.config.region,
    assumeRole: {
        roleArn: "<redacted>",
    },
});

new aws.s3.Bucket("testing-bucket", {}, { provider: testing });
new aws.s3.Bucket("staging-bucket", {}, { provider: staging });

When using the config system, this is a bit uglier, but it works:

$ pulumi config set aws:assumeRole "{ \"roleArn\": \"<redacted>\" }"

@pgavlin
Copy link
Member Author

pgavlin commented Sep 6, 2018

(this will fix pulumi/pulumi-aws#252 when rolled out to pulumi-aws)

Ack, wrong issue--this will not fix that.

Copy link
Contributor

@lukehoban lukehoban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pgavlin pgavlin merged commit b444691 into master Sep 7, 2018
@pulumi-bot pulumi-bot deleted the pgavlin/jsonConfig branch September 7, 2018 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants