Skip to content

Commit

Permalink
Convert Go Azure examples to fnOutput form (pulumi#1154)
Browse files Browse the repository at this point in the history
* updated azure-go-aci dependencies and simplified outputs

* updated azure-go-aks dependencies, kubernetes version, broke out kubeconfig function

* azure-go-aks-helm bumped package version and kubernetes version to azure compatible one. removed KubeDashboard since incompatible with azure compatible kubernetes

* azure-go-aks-multicluster bumped azure-native version and kubernetes version

* azure-go-appservice-docker updated azure-native dependency. changed image to pull since the old image 404s. refactored to use fnOutput form

* azure-go-appservice-docker changed image to dockerhub nginx

* azure-go-call-azure-sdk bumped aws-native version 1.53.0

* bumped the version fixed upgrade errors

* updated comment on azure-go-appservice-docker/main.go

* improved azure-go-aks example

* refactored azure-go-ask-helm

Co-authored-by: Kyle Dixler <[email protected]>
  • Loading branch information
dixler and Kyle Dixler committed Jan 21, 2022
1 parent 442ef82 commit 04e4a18
Show file tree
Hide file tree
Showing 23 changed files with 150 additions and 210 deletions.
4 changes: 2 additions & 2 deletions azure-go-aci/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/pulumi/examples/azure-go-aci
go 1.15

require (
github.com/pulumi/pulumi-azure-native/sdk v1.0.0
github.com/pulumi/pulumi/sdk/v3 v3.0.0
github.com/pulumi/pulumi-azure-native/sdk v1.53.0
github.com/pulumi/pulumi/sdk/v3 v3.20.0
)
131 changes: 10 additions & 121 deletions azure-go-aci/go.sum

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions azure-go-aci/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@ func main() {
return err
}

ctx.Export("containerIPv4Address", containerGroup.IpAddress.ApplyT(func(ip *containerinstance.IpAddressResponse) (string, error) {
if ip == nil || ip.Ip == nil {
return "", nil
}
return *ip.Ip, nil
}).(pulumi.StringOutput))
ctx.Export("containerIPv4Address", containerGroup.IpAddress.Ip())

return nil
})
Expand Down
33 changes: 12 additions & 21 deletions azure-go-aks-helm/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ func buildCluster(ctx *pulumi.Context, cfg Config) (*ClusterInfo, error) {
k8sCluster, err := cs.NewManagedCluster(ctx, "cluster",
&cs.ManagedClusterArgs{
ResourceGroupName: resourceGroup.Name,
AddonProfiles: cs.ManagedClusterAddonProfileMap{
"KubeDashboard": cs.ManagedClusterAddonProfileArgs{
Enabled: pulumi.Bool(true),
},
},
AgentPoolProfiles: cs.ManagedClusterAgentPoolProfileArray{
cs.ManagedClusterAgentPoolProfileArgs{
Count: pulumi.Int(cfg.NodeCount),
Expand Down Expand Up @@ -98,25 +93,21 @@ func buildCluster(ctx *pulumi.Context, cfg Config) (*ClusterInfo, error) {
}

func getKubeconfig(ctx *pulumi.Context, cluster *ClusterInfo) pulumi.StringOutput {
return pulumi.All(cluster.ManagedCluster.Name, cluster.ResourceGroup.Name).
ApplyT(func(names []interface{}) (string, error) {
k8sClusterName := names[0].(string)
resourceGroupName := names[1].(string)
out, err := cs.ListManagedClusterUserCredentials(ctx,
&cs.ListManagedClusterUserCredentialsArgs{
ResourceGroupName: resourceGroupName,
ResourceName: k8sClusterName,
},
)
if err != nil {
return "", err
}
decoded, err := base64.StdEncoding.DecodeString(out.Kubeconfigs[0].Value)
creds := cs.ListManagedClusterUserCredentialsOutput(ctx,
cs.ListManagedClusterUserCredentialsOutputArgs{
ResourceGroupName: cluster.ResourceGroup.Name,
ResourceName: cluster.ManagedCluster.Name,
},
)
kubeconfig := creds.Kubeconfigs().Index(pulumi.Int(0)).Value().
ApplyT(func(arg string) string {
kubeconfig, err := base64.StdEncoding.DecodeString(arg)
if err != nil {
return "", err
return ""
}
return string(decoded), nil
return string(kubeconfig)
}).(pulumi.StringOutput)
return kubeconfig
}

func buildProvider(
Expand Down
2 changes: 1 addition & 1 deletion azure-go-aks-helm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func configure(ctx *pulumi.Context) (Config, error) {

out.K8sVersion = cfg.Get("k8sVersion")
if out.K8sVersion == "" {
out.K8sVersion = "1.18.14"
out.K8sVersion = "1.22.2"
}

generatedKeyPair, err := tls.NewPrivateKey(ctx, "ssh-key",
Expand Down
4 changes: 2 additions & 2 deletions azure-go-aks-helm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module azure-go-aks-helm
go 1.15

require (
github.com/pulumi/pulumi-azure-native/sdk v1.0.0
github.com/pulumi/pulumi-azure-native/sdk v1.53.0
github.com/pulumi/pulumi-azuread/sdk/v4 v4.0.0
github.com/pulumi/pulumi-kubernetes/sdk/v3 v3.0.0
github.com/pulumi/pulumi-random/sdk/v4 v4.0.0
github.com/pulumi/pulumi-tls/sdk/v4 v4.0.0
github.com/pulumi/pulumi/sdk/v3 v3.0.0
github.com/pulumi/pulumi/sdk/v3 v3.20.0
)
9 changes: 9 additions & 0 deletions azure-go-aks-helm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ github.com/pulumi/pulumi-azure-native/sdk v0.7.1 h1:ss2Gm8tz+Z/5NG95tzZaNzR4wJE0
github.com/pulumi/pulumi-azure-native/sdk v0.7.1/go.mod h1:+sOZTR3B8SmjeJ+uiLjz9FCFj9VruMZf1lW846ZdKcE=
github.com/pulumi/pulumi-azure-native/sdk v1.0.0 h1:hkt1SRMuKPMgDzQrERbz/Ev9K0OtO4+C6t4gE/gyFM0=
github.com/pulumi/pulumi-azure-native/sdk v1.0.0/go.mod h1:+6SXTdCHr4vvAW7UUpYqJwXfF2nqDSVKHOs0zXOlfBY=
github.com/pulumi/pulumi-azure-native/sdk v1.53.0 h1:jrcGpA4NKH42yV9O76EVpSF8I93aeKB9Fae7M4kb1L0=
github.com/pulumi/pulumi-azure-native/sdk v1.53.0/go.mod h1:9uZoN23JHENKfngVUlZdFr1eRYXpRF8saW5eSASw0tY=
github.com/pulumi/pulumi-azuread/sdk/v3 v3.5.0 h1:1HG5pOt1ng6ShNRD+2f3TGHedomfC6HRT1MEBfN8zjY=
github.com/pulumi/pulumi-azuread/sdk/v3 v3.5.0/go.mod h1:2V1t2Ceb5qk26RkqvBmJzDOZ+6E8bf/HDQbIW3iMNU4=
github.com/pulumi/pulumi-azuread/sdk/v4 v4.0.0 h1:Fo8KNxSTyStg8R4aDMr4/cDEVnTkE262iio76Sol2Mw=
Expand All @@ -262,6 +264,10 @@ github.com/pulumi/pulumi/sdk/v2 v2.21.2/go.mod h1:fCFhRV6NmidWetmgDPA76efL+s0JqL
github.com/pulumi/pulumi/sdk/v3 v3.0.0-beta.1/go.mod h1:of2on912OvQZLA33FfNUcTEgRrTId7jvk9yFuvtaV88=
github.com/pulumi/pulumi/sdk/v3 v3.0.0 h1:zkragE05t1Rco/ymfqMU4UXdEmKMmOH0SXhUKQxujxQ=
github.com/pulumi/pulumi/sdk/v3 v3.0.0/go.mod h1:GBHyQ7awNQSRmiKp/p8kIKrGrMOZeA/k2czoM/GOqds=
github.com/pulumi/pulumi/sdk/v3 v3.20.0 h1:GBQ0sBepo3W2xQm/osMD6JDC02qiMQwK4q4Yi4bdkHk=
github.com/pulumi/pulumi/sdk/v3 v3.20.0/go.mod h1:AnbQmAhp0ezO/MhcVjqkhvoQnxZ0+79Xb035NcuKrtM=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
Expand Down Expand Up @@ -398,6 +404,8 @@ golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2 h1:c8PlLMqBbOHoqtjteWm5/kbe6rNY2pbRfbIMVnepueo=
golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
Expand Down Expand Up @@ -478,5 +486,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
pgregory.net/rapid v0.4.7/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 h1:ucqkfpjg9WzSUubAO62csmucvxl4/JeW3F4I4909XkM=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
4 changes: 2 additions & 2 deletions azure-go-aks-multicluster/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module azure-go-aks-multicluster
go 1.16

require (
github.com/pulumi/pulumi-azure-native/sdk v1.0.0
github.com/pulumi/pulumi-azure-native/sdk v1.53.0
github.com/pulumi/pulumi-azuread/sdk/v4 v4.0.0
github.com/pulumi/pulumi/sdk/v3 v3.0.0
github.com/pulumi/pulumi/sdk/v3 v3.20.0
)
9 changes: 9 additions & 0 deletions azure-go-aks-multicluster/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ github.com/pulumi/pulumi-azure-native/sdk v0.8.0 h1:IBINThu99ApZ2ZaVxerF5QflLgUE
github.com/pulumi/pulumi-azure-native/sdk v0.8.0/go.mod h1:D/zqGWwHxDfGyjiJlmMxWN0boUTr4ZxMigEPLeHLMac=
github.com/pulumi/pulumi-azure-native/sdk v1.0.0 h1:hkt1SRMuKPMgDzQrERbz/Ev9K0OtO4+C6t4gE/gyFM0=
github.com/pulumi/pulumi-azure-native/sdk v1.0.0/go.mod h1:+6SXTdCHr4vvAW7UUpYqJwXfF2nqDSVKHOs0zXOlfBY=
github.com/pulumi/pulumi-azure-native/sdk v1.53.0 h1:jrcGpA4NKH42yV9O76EVpSF8I93aeKB9Fae7M4kb1L0=
github.com/pulumi/pulumi-azure-native/sdk v1.53.0/go.mod h1:9uZoN23JHENKfngVUlZdFr1eRYXpRF8saW5eSASw0tY=
github.com/pulumi/pulumi-azuread/sdk/v3 v3.5.1 h1:tEWr5bWBFpQwxRoun6Ai7dTqz/BrwxeR9Prvkd/xU5M=
github.com/pulumi/pulumi-azuread/sdk/v3 v3.5.1/go.mod h1:2V1t2Ceb5qk26RkqvBmJzDOZ+6E8bf/HDQbIW3iMNU4=
github.com/pulumi/pulumi-azuread/sdk/v4 v4.0.0 h1:Fo8KNxSTyStg8R4aDMr4/cDEVnTkE262iio76Sol2Mw=
Expand All @@ -248,6 +250,10 @@ github.com/pulumi/pulumi/sdk/v2 v2.24.1/go.mod h1:sHQdzD0/cIopR5uLeoikXi1pNBv5Sw
github.com/pulumi/pulumi/sdk/v3 v3.0.0-beta.1/go.mod h1:of2on912OvQZLA33FfNUcTEgRrTId7jvk9yFuvtaV88=
github.com/pulumi/pulumi/sdk/v3 v3.0.0 h1:zkragE05t1Rco/ymfqMU4UXdEmKMmOH0SXhUKQxujxQ=
github.com/pulumi/pulumi/sdk/v3 v3.0.0/go.mod h1:GBHyQ7awNQSRmiKp/p8kIKrGrMOZeA/k2czoM/GOqds=
github.com/pulumi/pulumi/sdk/v3 v3.20.0 h1:GBQ0sBepo3W2xQm/osMD6JDC02qiMQwK4q4Yi4bdkHk=
github.com/pulumi/pulumi/sdk/v3 v3.20.0/go.mod h1:AnbQmAhp0ezO/MhcVjqkhvoQnxZ0+79Xb035NcuKrtM=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
Expand Down Expand Up @@ -378,6 +384,8 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2 h1:c8PlLMqBbOHoqtjteWm5/kbe6rNY2pbRfbIMVnepueo=
golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
Expand Down Expand Up @@ -457,5 +465,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
pgregory.net/rapid v0.4.7/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 h1:ucqkfpjg9WzSUubAO62csmucvxl4/JeW3F4I4909XkM=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
2 changes: 1 addition & 1 deletion azure-go-aks-multicluster/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func main() {
},
},
DnsPrefix: pulumi.String(fmt.Sprintf("%s-kube", ctx.Stack())),
KubernetesVersion: pulumi.String("1.18.14"),
KubernetesVersion: pulumi.String("1.22.2"),
})
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions azure-go-aks/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module goaks
go 1.15

require (
github.com/pulumi/pulumi-azure-native/sdk v1.0.0
github.com/pulumi/pulumi-azure-native/sdk v1.53.0
github.com/pulumi/pulumi-azuread/sdk/v4 v4.0.0
github.com/pulumi/pulumi-random/sdk/v4 v4.0.0
github.com/pulumi/pulumi-tls/sdk/v4 v4.0.0
github.com/pulumi/pulumi/sdk/v3 v3.0.0
github.com/pulumi/pulumi/sdk/v3 v3.20.0
)
9 changes: 9 additions & 0 deletions azure-go-aks/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ github.com/pulumi/pulumi-azure-native/sdk v0.7.1 h1:ss2Gm8tz+Z/5NG95tzZaNzR4wJE0
github.com/pulumi/pulumi-azure-native/sdk v0.7.1/go.mod h1:+sOZTR3B8SmjeJ+uiLjz9FCFj9VruMZf1lW846ZdKcE=
github.com/pulumi/pulumi-azure-native/sdk v1.0.0 h1:hkt1SRMuKPMgDzQrERbz/Ev9K0OtO4+C6t4gE/gyFM0=
github.com/pulumi/pulumi-azure-native/sdk v1.0.0/go.mod h1:+6SXTdCHr4vvAW7UUpYqJwXfF2nqDSVKHOs0zXOlfBY=
github.com/pulumi/pulumi-azure-native/sdk v1.53.0 h1:jrcGpA4NKH42yV9O76EVpSF8I93aeKB9Fae7M4kb1L0=
github.com/pulumi/pulumi-azure-native/sdk v1.53.0/go.mod h1:9uZoN23JHENKfngVUlZdFr1eRYXpRF8saW5eSASw0tY=
github.com/pulumi/pulumi-azuread/sdk/v2 v2.4.0 h1:Cpr2odOCkzyKg3/RrcgYubARtihvd50SjxWl3N6DuBI=
github.com/pulumi/pulumi-azuread/sdk/v2 v2.4.0/go.mod h1:xOo5e0+RVfT6169djjoWCMixlYzuUSFZMbWGYGVI+Aw=
github.com/pulumi/pulumi-azuread/sdk/v4 v4.0.0 h1:Fo8KNxSTyStg8R4aDMr4/cDEVnTkE262iio76Sol2Mw=
Expand All @@ -264,6 +266,10 @@ github.com/pulumi/pulumi/sdk/v2 v2.21.2/go.mod h1:fCFhRV6NmidWetmgDPA76efL+s0JqL
github.com/pulumi/pulumi/sdk/v3 v3.0.0-beta.1/go.mod h1:of2on912OvQZLA33FfNUcTEgRrTId7jvk9yFuvtaV88=
github.com/pulumi/pulumi/sdk/v3 v3.0.0 h1:zkragE05t1Rco/ymfqMU4UXdEmKMmOH0SXhUKQxujxQ=
github.com/pulumi/pulumi/sdk/v3 v3.0.0/go.mod h1:GBHyQ7awNQSRmiKp/p8kIKrGrMOZeA/k2czoM/GOqds=
github.com/pulumi/pulumi/sdk/v3 v3.20.0 h1:GBQ0sBepo3W2xQm/osMD6JDC02qiMQwK4q4Yi4bdkHk=
github.com/pulumi/pulumi/sdk/v3 v3.20.0/go.mod h1:AnbQmAhp0ezO/MhcVjqkhvoQnxZ0+79Xb035NcuKrtM=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
Expand Down Expand Up @@ -407,6 +413,8 @@ golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2 h1:c8PlLMqBbOHoqtjteWm5/kbe6rNY2pbRfbIMVnepueo=
golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
Expand Down Expand Up @@ -492,5 +500,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
pgregory.net/rapid v0.4.7/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 h1:ucqkfpjg9WzSUubAO62csmucvxl4/JeW3F4I4909XkM=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
33 changes: 16 additions & 17 deletions azure-go-aks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,28 @@ func main() {
ClientId: adApp.ApplicationId,
Secret: adSpPassword.Value,
},
KubernetesVersion: pulumi.String("1.18.14"),
KubernetesVersion: pulumi.String("1.22.2"),
})
if err != nil {
return err
}

ctx.Export("kubeconfig", pulumi.All(cluster.Name, resourceGroup.Name, resourceGroup.ID()).ApplyT(func(args interface{}) (string, error) {
clusterName := args.([]interface{})[0].(string)
resourceGroupName := args.([]interface{})[1].(string)
creds, err := containerservice.ListManagedClusterUserCredentials(ctx, &containerservice.ListManagedClusterUserCredentialsArgs{
ResourceGroupName: resourceGroupName,
ResourceName: clusterName,
creds := containerservice.ListManagedClusterUserCredentialsOutput(ctx,
containerservice.ListManagedClusterUserCredentialsOutputArgs{
ResourceGroupName: resourceGroup.Name,
ResourceName: cluster.Name,
})
if err != nil {
return "", err
}
encoded := creds.Kubeconfigs[0].Value
kubeconfig, err := base64.StdEncoding.DecodeString(encoded)
if err != nil {
return "", err
}
return string(kubeconfig), nil
}))

kubeconfig := creds.Kubeconfigs().Index(pulumi.Int(0)).Value().
ApplyT(func(encoded string) string {
kubeconfig, err := base64.StdEncoding.DecodeString(encoded)
if err != nil {
return ""
}
return string(kubeconfig)
})

ctx.Export("kubeconfig", kubeconfig)

return nil
})
Expand Down
28 changes: 26 additions & 2 deletions azure-go-appservice-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,33 @@ The example shows two scenarios:

```
$ pulumi stack output helloEndpoint
http:https://hello-app-91dfea.azurewebsites.net/hello
https:https://helloappecc2f992.azurewebsites.net
$ curl "$(pulumi stack output helloEndpoint)"
Hello, world!
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http:https://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http:https://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
$ pulumi stack output getStartedEndpoint
http:https://get-started-15da13.azurewebsites.net
Expand Down
4 changes: 2 additions & 2 deletions azure-go-appservice-docker/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/pulumi/examples/azure-go-appservice
go 1.15

require (
github.com/pulumi/pulumi-azure-native/sdk v1.0.0
github.com/pulumi/pulumi-azure-native/sdk v1.53.0
github.com/pulumi/pulumi-docker/sdk/v3 v3.0.0
github.com/pulumi/pulumi/sdk/v3 v3.0.0
github.com/pulumi/pulumi/sdk/v3 v3.20.0
)
Loading

0 comments on commit 04e4a18

Please sign in to comment.