Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Importing SG Rule from tfstate file doesn't work #208

Open
vibhor13 opened this issue Oct 15, 2024 · 2 comments
Open

AWS Importing SG Rule from tfstate file doesn't work #208

vibhor13 opened this issue Oct 15, 2024 · 2 comments
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@vibhor13
Copy link

What happened?

while trying to import SG Rule from tfstate file , relevant section :

Get this error :

 aws:ec2:SecurityGroupRule (eks_worker_nodeport):
    error: Preview failed: importing sgrule-123456: unexpected format for ID ("sgrule-123456"), expected SECURITYGROUPID_TYPE_PROTOCOL_FROMPORT_TOPORT_SOURCE[_SOURCE]*: too few parts

while importing security group itself works fine .

Example

while trying to import SG Rule from tfstate file , relevant section :

  {
     "mode": "managed",
     "type": "aws_security_group_rule",
     "name": "eks_worker_nodeport",
     "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
     "instances": [
       {
         "schema_version": 2,
         "attributes": {
           "cidr_blocks": [
            <REDACTED>
           ],
           "description": "Allows communication with the cluster API Server",
           "from_port": 443,
           "id": "sgr-1234567",
           "ipv6_cidr_blocks": null,
           "prefix_list_ids": null,
           "protocol": "tcp",
           "security_group_id": "s<REDACTED>",
           "security_group_rule_id": "",
           "self": false,
           "source_security_group_id": null,
           "timeouts": null,
           "to_port": 443,
           "type": "ingress"
         },
         "sensitive_attributes": [],
         "private": "<REDACTED>",
         "dependencies": [
           "aws_security_group.eks_master"
         ]
       }
     ]
   },

got this error :

 aws:ec2:SecurityGroupRule (eks_worker_nodeport):
    error: Preview failed: importing sgrule-123456: unexpected format for ID ("sgrule-123456"), expected SECURITYGROUPID_TYPE_PROTOCOL_FROMPORT_TOPORT_SOURCE[_SOURCE]*: too few parts

Output of pulumi about

CLI
Version 3.134.1
Go Version go1.23.1
Go Compiler gc

Plugins
KIND NAME VERSION
resource aws 6.37.1
language go unknown

Host
OS ubuntu
Version 22.04
Arch x86_64

This project is written in go: executable='/usr/bin/go' version='go version go1.23.1 linux/amd64'

Backend
Name vanand-ThinkPad-P14s-Gen-2a
URL file:///home/vanand/work/pulumi-state-dev/
User vanand
Organizations
Token type personal

Dependencies:
NAME VERSION
github.com/pulumi/pulumi-aws/sdk/v6 v6.37.1
github.com/pulumi/pulumi/sdk/v3 v3.117.0

Pulumi locates its logs in /tmp by default
warning: Failed to get information about the current stack: No current snapshot

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@vibhor13 vibhor13 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 15, 2024
@justinvp justinvp removed the needs-triage Needs attention from the triage team label Oct 15, 2024
@justinvp
Copy link
Member

Thanks for opening the issue @vibhor13. We likely need to implement a custom mapping for SecurityGroupRule to map it to the appropriate import id format.

@justinvp justinvp transferred this issue from pulumi/pulumi Oct 15, 2024
@pulumi-bot pulumi-bot added the needs-triage Needs attention from the triage team label Oct 15, 2024
@justinvp justinvp removed the needs-triage Needs attention from the triage team label Oct 15, 2024
@vibhor13
Copy link
Author

Thanks for acknowledging this , is there a suggestive fix for now ? O/w I will need to modify the state to include the security group rule with the security group itself .

Also any ballpark ETA would be of great help , Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

3 participants