Skip to content

Commit b30c61a

Browse files
committed
feat: Add Azure provider
1 parent 8924022 commit b30c61a

19 files changed

+1629
-88
lines changed

go.mod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.16
44

55
require (
66
github.com/AlecAivazis/survey/v2 v2.3.2
7+
github.com/Azure/azure-sdk-for-go v56.3.0+incompatible
78
github.com/Microsoft/go-winio v0.5.0 // indirect
89
github.com/davecgh/go-spew v1.1.1
910
github.com/docker/cli v20.10.12+incompatible
@@ -28,8 +29,11 @@ require (
2829
github.com/pkg/errors v0.9.1
2930
github.com/pterm/pterm v0.12.34
3031
github.com/pulumi/pulumi-aws/sdk/v4 v4.33.0
32+
github.com/pulumi/pulumi-azure-native/sdk v1.56.0
33+
github.com/pulumi/pulumi-azure/sdk/v4 v4.36.0
34+
github.com/pulumi/pulumi-azuread/sdk/v5 v5.16.0
3135
github.com/pulumi/pulumi-docker/sdk/v3 v3.1.0
32-
github.com/pulumi/pulumi/sdk/v3 v3.14.0
36+
github.com/pulumi/pulumi/sdk/v3 v3.23.2
3337
github.com/robfig/cron/v3 v3.0.1
3438
github.com/spf13/cobra v1.2.1
3539
github.com/spf13/viper v1.9.0

go.sum

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ github.com/Azure/azure-sdk-for-go v30.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9mo
9191
github.com/Azure/azure-sdk-for-go v35.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
9292
github.com/Azure/azure-sdk-for-go v38.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
9393
github.com/Azure/azure-sdk-for-go v42.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
94+
github.com/Azure/azure-sdk-for-go v56.3.0+incompatible h1:DmhwMrUIvpeoTDiWRDtNHqelNUd3Og8JCkrLHQK795c=
9495
github.com/Azure/azure-sdk-for-go v56.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
9596
github.com/Azure/azure-service-bus-go v0.9.1/go.mod h1:yzBx6/BUGfjfeqbRZny9AQIbIe3AcV9WZbAdpkoXOa0=
9697
github.com/Azure/azure-storage-blob-go v0.8.0/go.mod h1:lPI3aLPpuLTeUwh1sViKXFxwl2B6teiRqI0deQUvsw0=
@@ -103,13 +104,15 @@ github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSW
103104
github.com/Azure/go-autorest v10.15.5+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
104105
github.com/Azure/go-autorest v12.0.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
105106
github.com/Azure/go-autorest v14.1.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
107+
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
106108
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
107109
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
108110
github.com/Azure/go-autorest/autorest v0.9.3/go.mod h1:GsRuLYvwzLjjjRoWEIyMUaYq8GNUx2nRB378IPt/1p0=
109111
github.com/Azure/go-autorest/autorest v0.9.6/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUdAmGFqi0vUdVNNx8q630=
110112
github.com/Azure/go-autorest/autorest v0.10.2/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUdAmGFqi0vUdVNNx8q630=
111113
github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw=
112114
github.com/Azure/go-autorest/autorest v0.11.17/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw=
115+
github.com/Azure/go-autorest/autorest v0.11.18 h1:90Y4srNYrwOtAgVo3ndrQkTYn6kf1Eg/AjTFJ8Is2aM=
113116
github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA=
114117
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
115118
github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc=
@@ -121,6 +124,7 @@ github.com/Azure/go-autorest/autorest/adal v0.9.2/go.mod h1:/3SMAM86bP6wC9Ev35pe
121124
github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A=
122125
github.com/Azure/go-autorest/autorest/adal v0.9.11/go.mod h1:nBKAnTomx8gDtl+3ZCJv2v0KACFHWTB2drffI1B68Pk=
123126
github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M=
127+
github.com/Azure/go-autorest/autorest/adal v0.9.14 h1:G8hexQdV5D4khOXrWG2YuLCFKhWYmWD8bHYaXN5ophk=
124128
github.com/Azure/go-autorest/autorest/adal v0.9.14/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M=
125129
github.com/Azure/go-autorest/autorest/azure/auth v0.4.2/go.mod h1:90gmfKdlmKgfjUpnCEpOJzsUEjrWDSLwHIG73tSXddM=
126130
github.com/Azure/go-autorest/autorest/azure/auth v0.5.8/go.mod h1:kxyKZTSfKh8OVFWPAgOgQ/frrJgeYQJPyR5fLFmXko4=
@@ -129,22 +133,27 @@ github.com/Azure/go-autorest/autorest/azure/cli v0.4.2/go.mod h1:7qkJkT+j6b+hIpz
129133
github.com/Azure/go-autorest/autorest/azure/cli v0.4.3/go.mod h1:yAQ2b6eP/CmLPnmLvxtT1ALIY3OR1oFcCqVBi8vHiTc=
130134
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
131135
github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=
136+
github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw=
132137
github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
133138
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
134139
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
135140
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
136141
github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
142+
github.com/Azure/go-autorest/autorest/mocks v0.4.1 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk=
137143
github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
138144
github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocmRAJWqST1wQYhyyjXJ3SJc=
139145
github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA=
140146
github.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE=
141147
github.com/Azure/go-autorest/autorest/validation v0.1.0/go.mod h1:Ha3z/SqBeaalWQvokg3NZAlQTalVMtOIAs1aGK7G6u8=
142148
github.com/Azure/go-autorest/autorest/validation v0.2.0/go.mod h1:3EEqHnBxQGHXRYq3HT1WyXAvT7LLY3tl70hw6tQIbjI=
149+
github.com/Azure/go-autorest/autorest/validation v0.3.1 h1:AgyqjAd94fwNAoTjl/WQXg4VvFeRFpO+UhNyRXqF1ac=
143150
github.com/Azure/go-autorest/autorest/validation v0.3.1/go.mod h1:yhLgjC0Wda5DYXl6JAsWyUe4KVNffhoDhG0zVzUMo3E=
144151
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
145152
github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
153+
github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg=
146154
github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
147155
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
156+
github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=
148157
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
149158
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
150159
github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
@@ -575,6 +584,7 @@ github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4
575584
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
576585
github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
577586
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
587+
github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk=
578588
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
579589
github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
580590
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
@@ -1374,6 +1384,7 @@ github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR
13741384
github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA=
13751385
github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw=
13761386
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
1387+
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
13771388
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
13781389
github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
13791390
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -1440,11 +1451,19 @@ github.com/pterm/pterm v0.12.34 h1:6zfluSNr1P3u76TnjOr0ISe+AOZH+MZoFX57Zs1pm0k=
14401451
github.com/pterm/pterm v0.12.34/go.mod h1:NjiL09hFhT/vWjQHSj1athJpx6H8cjpHXNAK5bUw8T8=
14411452
github.com/pulumi/pulumi-aws/sdk/v4 v4.33.0 h1:nWLb44mR365UzLVvjCa6I0nuQY3ngXhVHnJm9nyVbac=
14421453
github.com/pulumi/pulumi-aws/sdk/v4 v4.33.0/go.mod h1:cmji+08wmrwoWheCupYXaBQSLeibCNr4zXaqS6iYAys=
1454+
github.com/pulumi/pulumi-azure-native/sdk v1.56.0 h1:eJHOh78mgb8+tnk6wODo4FxwALqq4Bf1V5HuTVkzkuc=
1455+
github.com/pulumi/pulumi-azure-native/sdk v1.56.0/go.mod h1:5l+UEpggoWApYLSHJO2GlzMyhopoHgtuDOGPQQ0fFE4=
1456+
github.com/pulumi/pulumi-azure/sdk/v4 v4.36.0 h1:TK3HtphNsk4C/F34W3rzzLY5z0QgcGHcSwI0HDcUHt0=
1457+
github.com/pulumi/pulumi-azure/sdk/v4 v4.36.0/go.mod h1:fzMnj7Qozw8YedBpdEKTXhWKDRq66+6lbpyGXYLGpVM=
1458+
github.com/pulumi/pulumi-azuread/sdk/v5 v5.16.0 h1:r6tJWsnGhQn4QT0K6agaRZFxjlZSVUu5N5yH4aLZgok=
1459+
github.com/pulumi/pulumi-azuread/sdk/v5 v5.16.0/go.mod h1:dUUTqKMxqp3LvfdlaCzFlFsv8ONLAxk3JzOzGhVBbDM=
14431460
github.com/pulumi/pulumi-docker/sdk/v3 v3.1.0 h1:eba1cKq5LSjCF9f96gvMtjIbZdzwJfM0xG+/vzFDsF0=
14441461
github.com/pulumi/pulumi-docker/sdk/v3 v3.1.0/go.mod h1:KusFPDVt8YTZj58vpa7gJyQyXoPkrHOKyw5k06bT340=
14451462
github.com/pulumi/pulumi/sdk/v3 v3.0.0/go.mod h1:GBHyQ7awNQSRmiKp/p8kIKrGrMOZeA/k2czoM/GOqds=
1446-
github.com/pulumi/pulumi/sdk/v3 v3.14.0 h1:UXLRHGQCsO1tLWdv4IO3IQOXrUoZUHhDtDXFoGMmAtA=
14471463
github.com/pulumi/pulumi/sdk/v3 v3.14.0/go.mod h1:aT7YmFdR6/T7tp2tMIZ68WRD1Xyv5a6Y4BhsuaCNpW0=
1464+
github.com/pulumi/pulumi/sdk/v3 v3.14.1-0.20211007222624-789e39219452/go.mod h1:aT7YmFdR6/T7tp2tMIZ68WRD1Xyv5a6Y4BhsuaCNpW0=
1465+
github.com/pulumi/pulumi/sdk/v3 v3.23.2 h1:m/YfyUsoeRFyHXDm2HtJhK+tBV58nrdmWsAkNQimRU4=
1466+
github.com/pulumi/pulumi/sdk/v3 v3.23.2/go.mod h1:WHOQB00iuHZyXhwrymxpKXhpOahSguJIpRjVokmM11w=
14481467
github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI=
14491468
github.com/quasilyte/go-ruleguard v0.1.2-0.20200318202121-b00d7a75d3d8/go.mod h1:CGFX09Ci3pq9QZdj86B+VGIdNj4VyCo2iPOGS9esB/k=
14501469
github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30=
@@ -1470,6 +1489,8 @@ github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
14701489
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
14711490
github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
14721491
github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
1492+
github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg=
1493+
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
14731494
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
14741495
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
14751496
github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto=

pkg/codeconfig/codeconfig.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func (c *codeConfig) collectOne(handler string) error {
268268
hostConfig.ExtraHosts = []string{"host.docker.internal:172.17.0.1"}
269269
}
270270

271-
cID, err := ce.ContainerCreate(&container.Config{
271+
cc := &container.Config{
272272
AttachStdout: true,
273273
AttachStderr: true,
274274
Image: opts.Image,
@@ -281,7 +281,9 @@ func (c *codeConfig) collectOne(handler string) error {
281281
Cmd: opts.Cmd,
282282
Entrypoint: opts.Entrypoint,
283283
WorkingDir: opts.TargetWD,
284-
}, hostConfig, nil, rt.ContainerName())
284+
}
285+
286+
cID, err := ce.ContainerCreate(cc, hostConfig, nil, rt.ContainerName())
285287
if err != nil {
286288
return err
287289
}
@@ -292,6 +294,8 @@ func (c *codeConfig) collectOne(handler string) error {
292294
}
293295

294296
if output.VerboseLevel > 1 {
297+
fmt.Println(containerengine.Cli(cc, hostConfig))
298+
295299
logreader, err := ce.ContainerLogs(cID, types.ContainerLogsOptions{
296300
ShowStdout: true,
297301
ShowStderr: true,

pkg/provider/pulumi/aws/aws.go

Lines changed: 73 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"crypto/md5"
2222
"encoding/hex"
2323
"encoding/json"
24+
"fmt"
2425
"io/ioutil"
2526
"os"
2627

@@ -35,9 +36,10 @@ import (
3536
"github.com/pulumi/pulumi/sdk/v3/go/auto"
3637
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
3738

38-
"github.com/nitrictech/cli/pkg/provider/pulumi/types"
39+
"github.com/nitrictech/cli/pkg/provider/pulumi/common"
3940
"github.com/nitrictech/cli/pkg/stack"
4041
"github.com/nitrictech/cli/pkg/target"
42+
"github.com/nitrictech/cli/pkg/utils"
4143
v1 "github.com/nitrictech/nitric/pkg/api/nitric/v1"
4244
)
4345

@@ -47,31 +49,56 @@ type awsProvider struct {
4749
tmpDir string
4850
}
4951

50-
func New(s *stack.Stack, t *target.Target) types.PulumiProvider {
52+
func New(s *stack.Stack, t *target.Target) common.PulumiProvider {
5153
return &awsProvider{s: s, t: t}
5254
}
5355

54-
func (a *awsProvider) PluginName() string {
55-
return "aws"
56+
func (a *awsProvider) Plugins() []common.Plugin {
57+
return []common.Plugin{
58+
{
59+
Name: "aws",
60+
Version: "v4.37.1",
61+
},
62+
}
5663
}
5764

58-
func (a *awsProvider) PluginVersion() string {
59-
return "v4.0.0"
65+
func (a *awsProvider) SupportedRegions() []string {
66+
return []string{
67+
"us-east-1",
68+
"us-west-1",
69+
"us-west-2",
70+
"eu-west-1",
71+
"eu-central-1",
72+
"ap-southeast-1",
73+
"ap-northeast-1",
74+
"ap-southeast-2",
75+
"ap-northeast-2",
76+
"sa-east-1",
77+
"cn-north-1",
78+
"ap-south-1",
79+
}
6080
}
6181

62-
func (a *awsProvider) Configure(ctx context.Context, autoStack *auto.Stack) error {
63-
if a.t.Region != "" {
64-
return autoStack.SetConfig(ctx, "aws:region", auto.ConfigValue{Value: a.t.Region})
82+
func (a *awsProvider) Validate() error {
83+
found := false
84+
for _, r := range a.SupportedRegions() {
85+
if r == a.t.Region {
86+
found = true
87+
break
88+
}
89+
}
90+
if !found {
91+
return utils.NewNotSupportedErr(fmt.Sprintf("region %s not supported on provider %s", a.t.Region, a.t.Provider))
6592
}
6693
return nil
6794
}
6895

69-
func commonTags(ctx *pulumi.Context, name string) pulumi.StringMap {
70-
return pulumi.StringMap{
71-
"x-nitric-project": pulumi.String(ctx.Project()),
72-
"x-nitric-stack": pulumi.String(ctx.Stack()),
73-
"x-nitric-name": pulumi.String(name),
96+
func (a *awsProvider) Configure(ctx context.Context, autoStack *auto.Stack) error {
97+
if a.t.Region != "" {
98+
return autoStack.SetConfig(ctx, "aws:region", auto.ConfigValue{Value: a.t.Region})
7499
}
100+
101+
return nil
75102
}
76103

77104
func md5Hash(b []byte) string {
@@ -124,7 +151,7 @@ func (a *awsProvider) Deploy(ctx *pulumi.Context) error {
124151
// FIXME: Autonaming of topics disabled until improvements to
125152
// nitric topic name discovery is made for SNS topics.
126153
Name: pulumi.StringPtr(k),
127-
Tags: commonTags(ctx, k),
154+
Tags: common.Tags(ctx, k),
128155
})
129156
if err != nil {
130157
return errors.WithMessage(err, "sns topic "+k)
@@ -134,7 +161,7 @@ func (a *awsProvider) Deploy(ctx *pulumi.Context) error {
134161
buckets := map[string]*s3.Bucket{}
135162
for k := range a.s.Buckets {
136163
buckets[k], err = s3.NewBucket(ctx, k, &s3.BucketArgs{
137-
Tags: commonTags(ctx, k),
164+
Tags: common.Tags(ctx, k),
138165
})
139166
if err != nil {
140167
return errors.WithMessage(err, "s3 bucket "+k)
@@ -144,7 +171,7 @@ func (a *awsProvider) Deploy(ctx *pulumi.Context) error {
144171
queues := map[string]*sqs.Queue{}
145172
for k := range a.s.Queues {
146173
queues[k], err = sqs.NewQueue(ctx, k, &sqs.QueueArgs{
147-
Tags: commonTags(ctx, k),
174+
Tags: common.Tags(ctx, k),
148175
})
149176
if err != nil {
150177
return errors.WithMessage(err, "sqs queue "+k)
@@ -167,7 +194,7 @@ func (a *awsProvider) Deploy(ctx *pulumi.Context) error {
167194
HashKey: pulumi.String("_pk"),
168195
RangeKey: pulumi.String("_sk"),
169196
BillingMode: pulumi.String("PAY_PER_REQUEST"),
170-
Tags: commonTags(ctx, k),
197+
Tags: common.Tags(ctx, k),
171198
})
172199
if err != nil {
173200
return errors.WithMessage(err, "dynamodb table "+k)
@@ -191,46 +218,48 @@ func (a *awsProvider) Deploy(ctx *pulumi.Context) error {
191218
funcs := map[string]*Lambda{}
192219
principalMap := make(map[v1.ResourceType]map[string]*iam.Role)
193220
principalMap[v1.ResourceType_Function] = make(map[string]*iam.Role)
194-
for k, f := range a.s.Functions {
195-
image, err := newECRImage(ctx, f.Name, &ECRImageArgs{
196-
LocalImageName: f.ImageTagName(a.s, ""),
197-
SourceImageName: f.ImageTagName(a.s, a.t.Provider),
198-
AuthToken: authToken,
199-
TempDir: a.tmpDir})
200-
if err != nil {
201-
return errors.WithMessage(err, "function image tag "+f.Name)
202-
}
203-
funcs[k], err = newLambda(ctx, k, &LambdaArgs{
204-
Topics: topics,
205-
DockerImage: image.DockerImage,
206-
Compute: &f,
221+
222+
computes := []stack.Compute{}
223+
for _, c := range a.s.Functions {
224+
copy := c
225+
computes = append(computes, &copy)
226+
}
227+
for _, c := range a.s.Containers {
228+
copy := c
229+
computes = append(computes, &copy)
230+
}
231+
for _, c := range computes {
232+
localImageName := c.ImageTagName(a.s, "")
233+
234+
repo, err := ecr.NewRepository(ctx, localImageName, &ecr.RepositoryArgs{
235+
Tags: common.Tags(ctx, localImageName),
207236
})
208237
if err != nil {
209-
return errors.WithMessage(err, "lambda function "+f.Name)
238+
return err
210239
}
211240

212-
principalMap[v1.ResourceType_Function][k] = funcs[k].Role
213-
}
214-
215-
for k, c := range a.s.Containers {
216-
image, err := newECRImage(ctx, c.Name, &ECRImageArgs{
217-
LocalImageName: c.ImageTagName(a.s, ""),
241+
image, err := common.NewImage(ctx, c.Unit().Name, &common.ImageArgs{
242+
LocalImageName: localImageName,
218243
SourceImageName: c.ImageTagName(a.s, a.t.Provider),
219-
AuthToken: authToken,
244+
RepositoryUrl: repo.RepositoryUrl,
245+
Server: pulumi.String(authToken.ProxyEndpoint),
246+
Username: pulumi.String(authToken.UserName),
247+
Password: pulumi.String(authToken.Password),
220248
TempDir: a.tmpDir})
221249
if err != nil {
222-
return errors.WithMessage(err, "function image tag "+c.Name)
250+
return errors.WithMessage(err, "function image tag "+c.Unit().Name)
223251
}
224-
funcs[k], err = newLambda(ctx, k, &LambdaArgs{
252+
253+
funcs[c.Unit().Name], err = newLambda(ctx, c.Unit().Name, &LambdaArgs{
225254
Topics: topics,
226255
DockerImage: image.DockerImage,
227-
Compute: &c,
256+
Compute: c,
228257
})
229258
if err != nil {
230-
return errors.WithMessage(err, "lambda container "+c.Name)
259+
return errors.WithMessage(err, "lambda container "+c.Unit().Name)
231260
}
232261

233-
principalMap[v1.ResourceType_Function][k] = funcs[k].Role
262+
principalMap[v1.ResourceType_Function][c.Unit().Name] = funcs[c.Unit().Name].Role
234263
}
235264

236265
for k, v := range a.s.ApiDocs {
@@ -244,7 +273,6 @@ func (a *awsProvider) Deploy(ctx *pulumi.Context) error {
244273

245274
for _, p := range a.s.Policies {
246275
policyName, err := policyResourceName(p)
247-
248276
if err != nil {
249277
return err
250278
}

pkg/provider/pulumi/aws/gateway.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/apigatewayv2"
2424
awslambda "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/lambda"
2525
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
26+
27+
"github.com/nitrictech/cli/pkg/provider/pulumi/common"
2628
)
2729

2830
type ApiGatewayArgs struct {
@@ -100,7 +102,7 @@ func newApiGateway(ctx *pulumi.Context, name string, args *ApiGatewayArgs, opts
100102
res.Api, err = apigatewayv2.NewApi(ctx, name, &apigatewayv2.ApiArgs{
101103
Body: doc,
102104
ProtocolType: pulumi.String("HTTP"),
103-
Tags: commonTags(ctx, name),
105+
Tags: common.Tags(ctx, name),
104106
}, pulumi.Parent(res))
105107
if err != nil {
106108
return nil, err
@@ -110,7 +112,7 @@ func newApiGateway(ctx *pulumi.Context, name string, args *ApiGatewayArgs, opts
110112
AutoDeploy: pulumi.BoolPtr(true),
111113
Name: pulumi.String("$default"),
112114
ApiId: res.Api.ID(),
113-
Tags: commonTags(ctx, name+"DefaultStage"),
115+
Tags: common.Tags(ctx, name+"DefaultStage"),
114116
}, pulumi.Parent(res))
115117
if err != nil {
116118
return nil, err

0 commit comments

Comments
 (0)