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

Import Quicksight Analysis is missing definition part #2852

Open
Leon-Vojtech opened this issue Oct 4, 2023 · 2 comments
Open

Import Quicksight Analysis is missing definition part #2852

Leon-Vojtech opened this issue Oct 4, 2023 · 2 comments
Labels
area/import An issue related to `pulumi import` or the import resource option. kind/bug Some behavior is incorrect or out of spec

Comments

@Leon-Vojtech
Copy link

Leon-Vojtech commented Oct 4, 2023

What happened?

Hello,

I am trying to import existing Analysis (and Dashboard) from our Quicksight into code, because I don't want to specify everything manually. Problem is, that after import, generated code does not have definition part, only ids, name and permissions sections.

Example

pulumi import aws:quicksight/analysis:Analysis example "094764632126",9cbfe808-bf19-4c2b-bd01-146a897b8065 -o GeneratedAnalysis.java -y

this will generate file with stack part:

var example = new Analysis("example", AnalysisArgs.builder()
.analysisId("9cbfe808-bf19-4c2b-bd01-146a897b8065")
.awsAccountId("094764632126")
.name("Sales analysis 2")
.permissions(AnalysisPermissionArgs.builder()
.actions(
"quicksight:RestoreAnalysis",
"quicksight:UpdateAnalysisPermissions",
"quicksight:QueryAnalysis",
"quicksight:DescribeAnalysisPermissions",
"quicksight:UpdateAnalysis",
"quicksight:DeleteAnalysis",
"quicksight:DescribeAnalysis")
.principal("arn:aws:quicksight:us-east-1:094764632126:my-user")
.build())
.build(), CustomResourceOptions.builder()
.protect(true)
.build());

Output of pulumi about

CLI
Version 3.86.0
Go Version go1.21.1
Go Compiler gc

Plugins
NAME VERSION
aws 6.4.0-alpha.1696355176+634136cd
java unknown

Host
OS Microsoft Windows 11 Pro
Version 10.0.22621 Build 22621
Arch x86_64

This project is written in java: executable='C:\Program Files\Amazon Corretto\jdk17.0.7_7\bin\java.exe' version='openjdk 17.0.7 2023-04-18 LTS
OpenJDK Runtime Environment Corretto-17.0.7.7.1 (build 17.0.7+7-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.7.7.1 (build 17.0.7+7-LTS, mixed mode, sharing)' java='C:\Program Files\Amazon Corretto\jdk17.0.7_7\bin\java.exe' javac='17.0.7'

Current Stack: leonvojtech/quicksight-pulumi/dev

TYPE URN
pulumi:pulumi:Stack urn:pulumi:dev::quicksight-pulumi::pulumi:pulumi:Stack::quicksight-pulumi-dev
pulumi:providers:aws urn:pulumi:dev::quicksight-pulumi::pulumi:providers:aws::default_6_4_0_alpha_1696270400_fe2ae0f3
aws:quicksight/analysis:Analysis urn:pulumi:dev::quicksight-pulumi::aws:quicksight/analysis:Analysis::existingAnalysis

Found no pending operations associated with dev

Backend
Name pulumi.com
URL https://app.pulumi.com/leonvojtech
User leonvojtech
Organizations leonvojtech
Token type personal

No dependencies found

Additional context

I also tried this using Terraform, it imports also definition part, but it imports also parts, that does not make sense, like empty arrays, that throw errors (you need to manually remove them), some logical errors etc. That is why my colleague recommends me to try Pulumi.

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).

@Leon-Vojtech Leon-Vojtech added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 4, 2023
@pierskarsenbarg pierskarsenbarg transferred this issue from pulumi/pulumi Oct 4, 2023
@mikhailshilkov
Copy link
Member

@Leon-Vojtech Thank you for opening this issue. Do you happen to have a code snippet for me to provision aws:quicksight/analysis:Analysis resource and other related resources to reproduce this problem? Or have you created it all externally?

@mikhailshilkov mikhailshilkov added awaiting-feedback Blocked on input from the author and removed needs-triage Needs attention from the triage team labels Oct 5, 2023
@Leon-Vojtech
Copy link
Author

Leon-Vojtech commented Oct 5, 2023

Hello @mikhailshilkov,

I created it all manually in Quicksight, so I don't have any code that I can share, but if you have access to any instance of Quicksight, you can use even examples.

But it is easy to reproduce it:

Create dataset from test datasource (I tried it now with People Overview), create analysis from this dataset and create simple table with few columns.

Then if you try to import it using:

pulumi import aws:quicksight/analysis:Analysis example "account-id",analysis-id -o GeneratedAnalysis.java -y

you will get this:

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.quicksight.Analysis;
import com.pulumi.aws.quicksight.AnalysisArgs;
import com.pulumi.aws.quicksight.inputs.AnalysisPermissionArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Analysis("example", AnalysisArgs.builder()        
            .analysisId("f2333bb1-2b3f-4309-ae5f-a8c9860f1fd9")
            .awsAccountId("094764632126")
            .name("People Overview analysis")
            .permissions(AnalysisPermissionArgs.builder()
                .actions(                
                    "quicksight:RestoreAnalysis",
                    "quicksight:UpdateAnalysisPermissions",
                    "quicksight:QueryAnalysis",
                    "quicksight:DescribeAnalysisPermissions",
                    "quicksight:UpdateAnalysis",
                    "quicksight:DeleteAnalysis",
                    "quicksight:DescribeAnalysis")
                .principal("arn:aws:quicksight:us-east-1:094764632126:user/default/aevi-glue-admin/leon.vojtech@aevi.com")
                .build())
            .build(), CustomResourceOptions.builder()
                .protect(true)
                .build());

    }
}

And in the stack, you can see, that there is not any definitions part, so it is missing the most important part of Analysis.

@mikhailshilkov mikhailshilkov added needs-triage Needs attention from the triage team area/import An issue related to `pulumi import` or the import resource option. and removed awaiting-feedback Blocked on input from the author needs-triage Needs attention from the triage team labels Oct 17, 2023
This was referenced Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/import An issue related to `pulumi import` or the import resource option. kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants