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

Stack Stuck when Creating Gitlab or Github Repo #375

Open
danielxf007 opened this issue Aug 5, 2024 · 6 comments
Open

Stack Stuck when Creating Gitlab or Github Repo #375

danielxf007 opened this issue Aug 5, 2024 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@danielxf007
Copy link

Hello, when cloudformation is creating the repos using sdlf-cicd/template-cicd-sdlf-repositories.gitlab.yaml or sdlf-cicd/template-cicd-sdlf-repositories.github.yaml, the stack gets stuck on CREATE_IN_PROGRESS for the git resources, I've already activated gitlab and github extensions on cloudformation following the exmaple at https://github.com/aws-ia/cloudformation-gitlab-resource-providers/tree/main/GitLab-Projects-Project and https://github.com/aws-ia/cloudformation-github-resource-providers/tree/main/GitHub-Repositories-Repository, is there any additional configuration that I'm not aware of?

@danielxf007 danielxf007 added the question Further information is requested label Aug 5, 2024
@cnfait
Copy link
Contributor

cnfait commented Aug 6, 2024

The GitLab resource types can be a bit of a pain to use... can you try creating a simple stack with just a single GitLab project? this would make it easier to find where the issue is:

AWSTemplateFormatVersion: '2010-09-09'
Description: Shows how to create a GitLab project
Resources:
  MySampleProject:
    Type: GitLab::Projects::Project
    Properties:
      Name: my-sample-project

Let me know if you have the exact same issue with this template.

We're not completely happy with our GitLab support currently (and we consider our GitHub support not sufficiently tested yet), we're hoping to improve that later this month.

@danielxf007
Copy link
Author

Even for that one the stack gets stucked

@cnfait
Copy link
Contributor

cnfait commented Aug 6, 2024

There are several things you can check.

--

Permissions on the GitLab access token (I do not remember the names of the permissions, but something like read_api/write_api are required)

--

The IAM role used when registering the resource type on CloudFormation registry.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/registry.html

Can you check the trust relationships of this role? does it look like this?

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "resources.cloudformation.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

Usually these conditions are present too:

      "Condition": {
        "StringEquals": {
          "aws:SourceAccount": "123456789012"
        },
        "StringLike": {
          "aws:SourceArn": "arn:aws:cloudformation:us-east-1:123456789012:type/resource/Organization-Service-Resource/*"
        }

If the permissions on the role are not too broad you should try to create the stack without these conditions, check if it works, and if it does add them back one by one to understand what is causing the issue.

--

@danielxf007
Copy link
Author

I've already tried. I followed the example at https://github.com/aws-ia/cloudformation-gitlab-resource-providers/tree/main/GitLab-Projects-Project and I created the token with all permissions and I created a role with admin access and finally I did the part of the trust relationship with the source arn, yet it keeps getting stuck on CREATE_IN_PROGRESS

@cnfait
Copy link
Contributor

cnfait commented Aug 9, 2024

Honestly this sounds like some kind of networking issue between CloudFormation and your GitLab instance, I'm not sure I can easily help you.

As I said before though, we're hoping to improve our GitLab support later this month, so maybe that will help. This is quite a bit of work though, and the days go faster than I'd like.

@cristiambustos
Copy link

Hi @danielxf007, did you manage to solve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants