fast-hamburger-46413
10/08/2019, 6:05 PMfast-hamburger-46413
10/08/2019, 6:05 PMfast-hamburger-46413
10/08/2019, 6:06 PMimport pulumi
import pulumi_aws as aws
my_key_pair = aws.ec2.KeyPair("mytest",
public_key="REDACTED"
)
size = 't2.micro'
ami = aws.get_ami(
most_recent="true",
owners=["679593333241"],
filters=[
{"name":"name","values":["CentOS Linux 7 x86_64 HVM EBS*"]},
{"name":"architecture","values":["x86_64"]},
{"name":"root-device-type","values":["ebs"]}
])
master_sg = aws.ec2.SecurityGroup('master_sg',
description='Enable Salt master SSH access',
egress=[
{ 'protocol': '-1', 'fromPort': 0, 'toPort': 0, 'cidrBlocks': [ "0.0.0.0/0" ] }
],
ingress=[
{ 'protocol': 'tcp', 'from_port': 22, 'to_port': 22, 'cidr_blocks': ['0.0.0.0/0'] }
])
node2node_sg = aws.ec2.SecurityGroup('node2node_sg',
description='Enable Salt node to node all access',
ingress=[
{ 'protocol': '-1', 'from_port': 0, 'to_port': 0, 'self': True }
])
master_user_data = """#!/bin/bash -e
yum update -y
yum install -y <https://repo.saltstack.com/py3/redhat/salt-py3-repo-2019.2.el7.noarch.rpm>
yum install -y salt-master salt-ssh salt-cloud salt-api
sed -i "s|#auto_accept: False|auto_accept: True|g" /etc/salt/master
systemctl start salt-master
"""
master = aws.ec2.Instance('master',
instance_type=size,
security_groups=[master_sg.name, node2node_sg.name],
ami=ami.id,
key_name=my_key_pair,
user_data=master_user_data)
master_public_ip = master.public_ip
minion_user_data = """#!/bin/bash -e
yum update -y
yum install -y <https://repo.saltstack.com/py3/redhat/salt-py3-repo-2019.2.el7.noarch.rpm>
yum install -y salt-minion salt-ssh salt-cloud salt-api
mkdir -p /etc/salt/minion.d
sed -i "s|#master: salt|master: %s|g" /etc/salt/minion
systemctl start salt-minion
""" % master.private_ip
minion = aws.ec2.Instance('minion',
instance_type=size,
security_groups=[master_sg.name, node2node_sg.name],
ami=ami.id,
key_name=my_key_pair,
user_data=minion_user_data)
pulumi.export('sshLogin', "ssh -i ~/.ssh/id_rsa centos@%s" % master_public_ip)
pulumi.export('masterPrivateIp', master.private_ip)
pulumi.export('masterPublicHostName', master.public_dns)
fast-hamburger-46413
10/08/2019, 6:07 PMsshLogin
in the end of code always render as ssh -i ~/.ssh/id_rsa centos@<pulumi.output.Output object at 0x10a8ed450>
fast-hamburger-46413
10/08/2019, 6:09 PMfast-hamburger-46413
10/09/2019, 4:39 AMstocky-spoon-28903
10/09/2019, 10:52 AMapply
to interpolate in that way I believe @fast-hamburger-46413clever-nest-47198
10/10/2019, 9:56 PMclever-nest-47198
10/10/2019, 9:58 PMhigh-morning-18773
10/14/2019, 5:38 PMprivate_subnet_ids = []
private_subnet_2 = aws.ec2.Subnet(
"app-subnet-2",
vpc_id=vpc_id,
availability_zone="us-west-2b",
cidr_block="10.100.2.0/24",
map_public_ip_on_launch = 'false',
# Only assign public IP if we are exposing public subnets
tags={
"Name": "app-subnet-2",
},)
private_subnet_ids.append(private_subnet_2)
for psubnet in private_subnet_ids:
passociationname = str(psubnet.id) + "route_table_association"
passociationname = aws.ec2.RouteTableAssociation(
passociationname,
subnet_id = psubnet.id,
route_table_id = private_route_table.id,
)
high-morning-18773
10/14/2019, 5:41 PMType Name Plan
pulumi:pulumi:Stack mgmt-vpc-mgmt-vpc-prod
+ ├─ aws:ec2:RouteTableAssociation <pulumi.output.Output object at 0x1052d64d0>route_table_association create
+ ├─ aws:ec2:RouteTableAssociation <pulumi.output.Output object at 0x1052bd890>route_table_association create
+ ├─ aws:ec2:RouteTableAssociation <pulumi.output.Output object at 0x1052e9b90>route_table_association create
+ ├─ aws:ec2:RouteTableAssociation <pulumi.output.Output object at 0x1052e9210>route_table_association create
- ├─ aws:ec2:RouteTableAssociation <pulumi.output.Output object at 0x105a8f190>route_table_association delete
- ├─ aws:ec2:RouteTableAssociation <pulumi.output.Output object at 0x105aa8350>route_table_association delete
- ├─ aws:ec2:RouteTableAssociation <pulumi.output.Output object at 0x105a44650>route_table_association delete
- └─ aws:ec2:RouteTableAssociation <pulumi.output.Output object at 0x105aa87d0>route_table_association delete
Outputs:
+ privatename : "<pulumi.output.Output object at 0x1052bd890>route_table_association"
Resources:
+ 4 to create
- 4 to delete
8 changes. 18 unchanged
it recreates the routetable assodication.high-morning-18773
10/14/2019, 6:03 PMpassociationname = psubnet.id.apply(lambda id: id + "route_table_association")
this workscolossal-plastic-46140
10/15/2019, 3:13 PMfastly:index:Servicev1 (testing123):
error: Preview failed: unrecognized resource type (Read): fastly:index/servicev1:Servicev1
bright-orange-69401
10/18/2019, 6:15 AMpulumi_python
community,
I was wondering if it would be possible to deploy Pulumi resources via a web interface (e.g. Django Admin) ?
My use-case would be to deploy Github Buckets + AWS Cloud9 environments from a GUI and keep track of them in my Back Office.
Does it make sense to use Pulumi for that ?
@gentle-diamond-70147 @microscopic-florist-22719 what do you think ?white-jewelry-95626
10/19/2019, 6:00 PMwhite-jewelry-95626
10/20/2019, 11:44 PMwhite-jewelry-95626
10/20/2019, 11:47 PMwhite-jewelry-95626
10/20/2019, 11:49 PMwhite-jewelry-95626
10/20/2019, 11:50 PMwhite-jewelry-95626
10/20/2019, 11:50 PMwhite-jewelry-95626
10/20/2019, 11:54 PMwhite-jewelry-95626
10/20/2019, 11:56 PMbland-eye-59969
10/21/2019, 5:45 PMhigh-morning-18773
10/22/2019, 4:29 PMhigh-morning-18773
11/01/2019, 7:09 PMcolossal-room-15708
11/03/2019, 10:44 PMhigh-morning-18773
11/05/2019, 11:05 PM"sourceVersion": "source-version",
"secondarySourceVersions": {
"sourceIdentifier": "secondary-source-identifier",
"sourceVersion": "secondary-source-version"
},
<https://docs.aws.amazon.com/codebuild/latest/userguide/create-project.html#create-project-cli>
high-morning-18773
11/05/2019, 11:05 PMhigh-morning-18773
11/05/2019, 11:07 PMhigh-morning-18773
11/05/2019, 11:08 PMhigh-morning-18773
11/05/2019, 11:08 PM