important-market-84330
10/25/2023, 9:14 AMdry-keyboard-94795
10/25/2023, 9:24 AMdeleteBeforeCreate
implicitly for you. What resources are you having trouble with?important-market-84330
10/25/2023, 9:25 AMdry-keyboard-94795
10/25/2023, 9:26 AMargs
important-market-84330
10/25/2023, 9:26 AMdry-keyboard-94795
10/25/2023, 9:29 AMimportant-market-84330
10/25/2023, 9:30 AMdry-keyboard-94795
10/25/2023, 9:33 AMimportant-market-84330
10/25/2023, 9:36 AMdry-keyboard-94795
10/25/2023, 9:37 AMalias
option, so that pulumi handles the state migration. This will prevent the need for recreating the resource in awsimportant-market-84330
10/25/2023, 9:37 AMdry-keyboard-94795
10/25/2023, 9:40 AMalias
option will do the job for you hereimportant-market-84330
10/25/2023, 9:48 AM--delete-before-create
flag or some kind of global setting would fix this.dry-keyboard-94795
10/25/2023, 9:57 AMimportant-market-84330
10/25/2023, 10:02 AMprivate val networkAssociations = attachedSubnets
.map { subnet ->
subnet.id().applyValue { it ->
NetworkAssociation(
"clientvpn-attachment-${it}",
NetworkAssociationArgs.builder()
.clientVpnEndpointId(this.id())
.subnetId(subnet.id())
.build()
)
}
}
I changed the attachedSubnets
from a list with one private subnet to a list with one public subnet (in the same AZ)dry-keyboard-94795
10/25/2023, 10:08 AM${it}
?important-market-84330
10/25/2023, 10:08 AMsubnet.id().applyValue(it -> ...
)
dry-keyboard-94795
10/25/2023, 10:09 AMimportant-market-84330
10/25/2023, 10:09 AMIt's generally not a good idea to create resources within the Apply block.
Yes I read that, but I think I still make that mistake too much. Good point, will fix that!Output<String>
as a resource name, it gets tricky fast ...
I guess maybe that's just a bad idea π ? But for example when creating one resource per subnet it is very tempting to put the subnet name in the resource name.
And that is quite hard actually. How do people do this usually?dry-keyboard-94795
10/25/2023, 10:14 AMimportant-market-84330
10/25/2023, 10:18 AMprivate val networkAssociations = attachedSubnets
.mapIndexed { i, subnet ->
NetworkAssociation(
"clientvpn-attachment-$i",
NetworkAssociationArgs.builder()
.clientVpnEndpointId(this.id())
.subnetId(subnet.id())
.build(),
CustomResourceOptions.builder()
.aliases(Alias.builder().name("clientvpn-attachment-subnet-0b1ccce02a2395452").build())
.build()
)
}
Using the alias πdry-keyboard-94795
10/25/2023, 10:24 AMimportant-market-84330
10/25/2023, 10:24 AMclass MyVpc(...) : Vpc(...) {
val myCustomVpcResource = ...
private val myHiddenCustomVpcResource = ...
}