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

Can't import ActionsRepositoryAccessLevel object #642

Open
pylaligand opened this issue Apr 19, 2024 · 2 comments
Open

Can't import ActionsRepositoryAccessLevel object #642

pylaligand opened this issue Apr 19, 2024 · 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

@pylaligand
Copy link

What happened?

I am trying to import ActionsRepositoryAccessLevel resources for some already existing repositories. Even if the access level matches what's currently in GitHub, imports will fail because of a repository attribute that's allegedly missing from the "remote" state.

Example

  1. Create a new repository.
  2. Add a new resource:
github.ActionsRepositoryAccessLevel(
    f"actions-access-{repo_name}",
    repository=repo_name,
    access_level="none",
)
  1. Run a preview:
$ pulumi preview
Previewing update (<my org>/<my project>)

View in Browser (Ctrl+O): https://app.pulumi.com/<my org>/<my project>/<my stack>/previews/<some long id>

    Type                                          Name                                    Plan       Info
     pulumi:pulumi:Stack                           <stack name>                    
 =   ├─ github:index:ActionsRepositoryAccessLevel  actions-access-<repo name>          import     [diff: +repository]; 1 warning

Diagnostics:
  github:index:ActionsRepositoryAccessLevel (actions-access-<repo name>):
    warning: inputs to import do not match the existing resource; importing this resource will fail
  1. Observe in the "Diff" section of the update:
= github:index/actionsRepositoryAccessLevel:ActionsRepositoryAccessLevel: (import)
        [id=<repo name>]
        [urn=urn:pulumi:github-repos::github-repo-config::github:index/actionsRepositoryAccessLevel:ActionsRepositoryAccessLevel::actions-access-<repo name>]
        [provider=urn:pulumi:github-repos::github-repo-config::pulumi:providers:github::default_5_26_0::f836b71c-df2d-4455-860c-893fa312f3c1]
      + repository: "<repo name>"

Output of pulumi about

$ pulumi about
CLI          
Version      3.112.0
Go Version   go1.22.1
Go Compiler  gc

Plugins
NAME    VERSION
github  5.26.0
python  unknown

Host     
OS       ubuntu
Version  22.04
Arch     x86_64

This project is written in python: executable='/workspaces/.github-private/github-repo-config/venv/bin/python3' version='3.9.19'

<some details about my stack>

Found no pending operations associated with flexai/github-repos

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/pylaligand-flexai
User           pylaligand-flexai
Organizations  pylaligand-flexai, flexai
Token type     personal

Dependencies:
NAME           VERSION
cryptography   42.0.5
pip            24.0
pulumi_github  5.26.0
pulumi-policy  1.10.0
PyGithub       2.3.0
setuptools     69.2.0
wheel          0.43.0

Pulumi locates its logs in /tmp by default

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

@pylaligand pylaligand added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Apr 19, 2024
@iwahbe iwahbe added area/import An issue related to `pulumi import` or the import resource option. and removed needs-triage Needs attention from the triage team labels Apr 22, 2024
@iwahbe
Copy link
Member

iwahbe commented Apr 22, 2024

Hey @pylaligand. Thanks for reporting this issue. It looks like this bug is from a combination of two behaviors:

  1. A bug in the upstream provider: [FEAT]: github_actions_repository_access_level should set repository value integrations/terraform-provider-github#1599
  2. That Pulumi has stricter correctness requirements than terraform.

We will take a look at getting this working for you as soon as we have the time.

@mikhailshilkov
Copy link
Member

@pylaligand As a workaround, you should be able to import this resource with a pulumi import command.

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

3 participants