This message was deleted.
# aws
s
This message was deleted.
e
awsx version is 0.32
b
@elegant-architect-38580 awsx is a component resource, so you can’t import it that way. you need to import it as an
aws.ec2.SecurityGroup
e
I tried that but pulumi up still wants to create the resource
did this:
pulumi import aws:ec2/securityGroupRule:SecurityGroupRule <name_of resource_set_by_pulumi_program> <import_resource_reference>
b
okay so you’ve defined a security group with awsx but also imported it as an awsx resource. That won’t work. You’ll need to remove the awsx resource or set it as the parent during the import, which is not a well trodden path
e
security group is defined as awsx and ingress rules are defined on the security group resource like this:
Copy code
const natGatewayPublicIps = getConfigSection<string[]>('natGatewayPublicIps');

        natGatewayPublicIps.forEach((publicIp: string, index: number) => {
            this.securityGroup.createIngressRule(`${this._serviceName}-nat-gateway-ingress-${index}`, {
                fromPort: 443,
                toPort: 443,
                protocol: 'tcp',
                cidrBlocks: [`${publicIp}/32`],
            });
        });
    }
I need to import some additional IP's to the list which was click-opsed on the security group
b
it’s not clear how you’ll get from where you are to where you want to be to me, I’d probably just delete the clickops security group rule or not bother with the awsx implementation
e
it's production so we need to avoid downtime. My solution is to change it regular aws.ec2.SecurityGroupRule so I can import all rules to it in the state
Is this a general limitation with component resources?
b
it’s not, you can import with the
--parent
flag but with awsx before v1 and what you’re doing it’s a not easy to explain over slack
e
hehe, okay. Thanks for the help:)
I've imported all the rules to aws.ec2.SecurityGroupRule resources, but I am unable to delete the old awsx resources from state using
pulumi state delete
. get this error:
Copy code
error: No such resource "urn:pulumi:production::<stackname>::awsx:x:ec2:SecurityGroup:x:ec2:IngressSecurityGroupRule::<pulumi name of resource>" exists in the current state
Is this also because of the parent dependies? Doesn't look like pulumi state delete supports defining parents
I do see these old awsx resources listed in the state
b
that’s a shell escaping problem, there should be a
$
in there
do
pulumi state delete '<urn>'
with
'
instead of `"`”
🙌 1
e
i actually did not use
"
but added
'
which fixed it for me
🎉 1