How to use the pulumi.export function in pulumi

To help you get started, we’ve selected a few pulumi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulumi / infrastructure-as-code-workshop / labs / aws / python / lab-05 / code / step6.py View on Github external
metadata={
      "namespace": ns.metadata["name"],
      "labels": app_labels
    },
    spec={
      "ports": [{
          "port": 80,
          "target_port": 8080,
      }],
      "selector": app_labels,
      "type": "LoadBalancer",
    },
    opts=ResourceOptions(provider=k8s_provider)
)

export('url', Output.all(service.status['load_balancer']['ingress'][0]['hostname'], service.spec['ports'][0]['port']) \
       .apply(lambda args: f"http://{args[0]}:{round(args[1])}"))
github pulumi / automation-api-examples / python / inline_secrets_provider / main.py View on Github external
# Set the access policy for the bucket so all objects are readable
    s3.BucketPolicy("bucket-policy", bucket=site_bucket.id, policy=site_bucket.id.apply(lambda id: json.dumps({
        "Version": "2012-10-17",
        "Statement": {
            "Effect": "Allow",
            "Principal": "*",
            "Action": ["s3:GetObject"],
            # Policy refers to bucket explicitly
            "Resource": [f"arn:aws:s3:::{id}/*"]
        },
    })))

    # Export a secret
    pulumi.export("secret", pulumi.Output.secret("hello world"))
    # Export the website URL
    pulumi.export("website_url", site_bucket.website_endpoint)
github pulumi / pulumi / examples / multilang / __main__.py View on Github external
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import pulumi
from pulumi_aws import ec2

# pulumi.runtime.register_proxy_constructor("aws:ec2/securityGroup:SecurityGroup", ec2.SecurityGroup);

from mycomponent.python import MyComponent

res = MyComponent("n", input1=42)

pulumi.export("id2", res.myid)
pulumi.export("output1", res.output1)
pulumi.export("innerComponent", res.innerComponent.data)
pulumi.export("nodeSecurityGroupId", res.nodeSecurityGroup)
github pulumi / infrastructure-as-code-workshop / labs / aws / python / lab-01 / code / 04-updating-your-infrastructure / step2.py View on Github external
bucket = aws.s3.Bucket("my-bucket",
    website={
        "index_document": "index.html"
})

filepath = os.path.join("site", "index.html")
mime_type, _ = mimetypes.guess_type(filepath)
obj = aws.s3.BucketObject("index.html",
        bucket=bucket.name,
        source=pulumi.FileAsset(filepath),
        acl="public_read",
        content_type=mime_type
)

pulumi.export('bucket_name', bucket.bucket)
pulumi.export('bucket_endpoint', pulumi.Output.concat("http://", bucket.website_endpoint))
github bincyber / pitfall / e2e / aws / vpc / componentresource.py View on Github external
def export(self):
        pulumi.export("vpc", self.vpc)
        pulumi.export("internet_gateway", self.internet_gateway)
        pulumi.export("public_subnets", self.public_subnets)
        pulumi.export("public_route_table", self.public_route_table)
github pulumi / infrastructure-as-code-workshop / labs / aws / python / lab-04 / code / step6.py View on Github external
"apiVersion": "client.authentication.k8s.io/v1alpha1",
                    "command": "aws-iam-authenticator",
                    "args": [
                        "token",
                        "-i",
                        f"{cluster_name}",
                    ],
                },
            },
        }],
    }

# Create the KubeConfig Structure as per https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html
kubeconfig = Output.all(cluster.endpoint, cluster.certificate_authority["data"], cluster.name).apply(lambda args: generateKubeconfig(args[0], args[1], args[2]))

export("kubeconfig", kubeconfig)
github pulumi / pulumi / examples / multilang / __main__.py View on Github external
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import pulumi
from pulumi_aws import ec2

# pulumi.runtime.register_proxy_constructor("aws:ec2/securityGroup:SecurityGroup", ec2.SecurityGroup);

from mycomponent.python import MyComponent

res = MyComponent("n", input1=42)

pulumi.export("id2", res.myid)
pulumi.export("output1", res.output1)
pulumi.export("innerComponent", res.innerComponent.data)
pulumi.export("nodeSecurityGroupId", res.nodeSecurityGroup)
github pulumi / infrastructure-as-code-workshop / labs / aws / python / lab-05 / code / step4.py View on Github external
metadata={
      "namespace": ns.metadata["name"],
      "labels": app_labels
    },
    spec={
      "ports": [{
          "port": 80,
          "target_port": 8080,
      }],
      "selector": app_labels,
      "type": "LoadBalancer",
    },
    opts=ResourceOptions(provider=k8s_provider)
)

export('url', Output.all(service.status['load_balancer']['ingress'][0]['hostname'], service.spec['ports'][0]['port']) \
       .apply(lambda args: f"http://{args[0]}:{round(args[1])}"))
github pulumi / automation-api-examples / python / inline_secrets_provider / main.py View on Github external
content_type="text/html; charset=utf-8")  # set the MIME type of the file

    # Set the access policy for the bucket so all objects are readable
    s3.BucketPolicy("bucket-policy", bucket=site_bucket.id, policy=site_bucket.id.apply(lambda id: json.dumps({
        "Version": "2012-10-17",
        "Statement": {
            "Effect": "Allow",
            "Principal": "*",
            "Action": ["s3:GetObject"],
            # Policy refers to bucket explicitly
            "Resource": [f"arn:aws:s3:::{id}/*"]
        },
    })))

    # Export a secret
    pulumi.export("secret", pulumi.Output.secret("hello world"))
    # Export the website URL
    pulumi.export("website_url", site_bucket.website_endpoint)
github pulumi / pulumi-terraform / examples / localstate-python / __main__.py View on Github external
import os

import pulumi
from pulumi_terraform import state

config = pulumi.Config()
statefile = config.require("statefile")

script_dir = os.path.dirname(os.path.realpath(__file__))

s = state.RemoteStateReference("localstate", "local", state.LocalBackendArgs(path = os.path.join(script_dir, statefile)))

pulumi.export('vpcId', s.get_output("vpc_id"))
pulumi.export('publicSubnetIds', s.get_output("public_subnet_ids"))
pulumi.export('bucketArn', s.get_output("bucket_arn"))