coopnorge / provider-github

Apache License 2.0
22 stars 10 forks source link

RepositoryFile endless reconciliation loop #75

Open ilyalavrenov opened 1 month ago

ilyalavrenov commented 1 month ago

I've got what looks like a bug with the RepositoryFile resource type. Initial creation of a resource works fine. However when I make changes to the value of the content field, the provider seems to get stuck in an endless reconciliation loop where it pushes empty commits nonstop and eventually blows through the rate limits on the API. I'm using the most recent version of the provider, v0.10.0.

Steps to reproduce:

# create a new RepositoryFile
$ kubectl apply -f - <<EOF
apiVersion: repo.github.upbound.io/v1alpha1
kind: RepositoryFile
metadata:
  name: testfile
spec:
  forProvider:
    branch: main
    content: |
      foo: bar
    file: test.yaml
    overwriteOnCreate: true
    repository: test-repo
  providerConfigRef:
    name: github
EOF

# wait for the provider to sync the file to the remote repo

# change the file contents
$ kubectl apply -f - <<EOF
apiVersion: repo.github.upbound.io/v1alpha1
kind: RepositoryFile
metadata:
  name: testfile
spec:
  forProvider:
    branch: main
    content: |
      baz: qux
    file: test.yaml
    overwriteOnCreate: true
    repository: test-repo
  providerConfigRef:
    name: github
EOF

# provider gets stuck in a reconcile loop

This results in duplicate commits in the repository:

$ git log --oneline
3ee07dd (HEAD -> main, origin/main, origin/HEAD) Update test.yaml
3b54e5b Update test.yaml
9e01025 Update test.yaml
c69939c Update test.yaml
6b72ee1 Update test.yaml
07332d4 Update test.yaml
2b439cb Update test.yaml
e0c3ded Update test.yaml
7c28aec Update test.yaml
c0e3598 Update test.yaml
f0e17c0 Update test.yaml
97287c6 Add test.yaml
...

Looking at the provider debug logs, seems like it applies the changes and then immediately requeues:

2024-05-30T02:16:36Z    DEBUG   provider-github Calling the inner handler for Update event. {"gvk": "repo.github.upbound.io/v1alpha1, Kind=RepositoryFile", "name": "testfile", "queueLength": 0}
2024-05-30T02:16:36Z    DEBUG   provider-github Reconciling {"controller": "managed/repo.github.upbound.io/v1alpha1, kind=repositoryfile", "request": {"name":"testfile"}}
2024-05-30T02:16:36Z    DEBUG   provider-github Running terraform   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "args": ["apply", "-refresh-only", "-auto-approve", "-input=false", "-lock=false", "-json"]}
2024-05-30T02:16:37Z    DEBUG   provider-github refresh ended   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "out": "{\"@level\":\"info\",\"@message\":\"Terraform 1.3.6\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:36.769446Z\",\"terraform\":\"1.3.6\",\"type\":\"version\",\"ui\":\"1.0\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refreshing state... [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:37.207587Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_start\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refresh complete [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:37.711683Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_complete\"}\n{\"@level\":\"info\",\"@message\":\"Plan: 0 to add, 0 to change, 0 to destroy.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:37.713443Z\",\"changes\":{\"add\":0,\"change\":0,\"remove\":0,\"operation\":\"plan\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"Apply complete! Resources: 0 added, 0 changed, 0 destroyed.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:37.715611Z\",\"changes\":{\"add\":0,\"change\":0,\"remove\":0,\"operation\":\"apply\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"Outputs: 0\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:37.715642Z\",\"outputs\":{},\"type\":\"outputs\"}\n"}
2024-05-30T02:16:37Z    DEBUG   provider-github Running terraform   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "args": ["plan", "-refresh=false", "-input=false", "-lock=false", "-json"]}
2024-05-30T02:16:38Z    DEBUG   provider-github plan ended  {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "out": "{\"@level\":\"info\",\"@message\":\"Terraform 1.3.6\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:37.734401Z\",\"terraform\":\"1.3.6\",\"type\":\"version\",\"ui\":\"1.0\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Plan to update\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:38.168259Z\",\"change\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\"},\"type\":\"planned_change\"}\n{\"@level\":\"info\",\"@message\":\"Plan: 0 to add, 1 to change, 0 to destroy.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:38.168319Z\",\"changes\":{\"add\":0,\"change\":1,\"remove\":0,\"operation\":\"plan\"},\"type\":\"change_summary\"}\n"}
2024-05-30T02:16:38Z    DEBUG   provider-github Called plan on the resource.    {"uid": "c29b04b2-9088-45b5-8579-6ebefb71eb53", "name": "testfile", "gvk": "repo.github.upbound.io/v1alpha1, Kind=RepositoryFile", "upToDate": false}
2024-05-30T02:16:38Z    DEBUG   provider-github Successfully requested update of external resource  {"controller": "managed/repo.github.upbound.io/v1alpha1, kind=repositoryfile", "request": {"name":"testfile"}, "uid": "c29b04b2-9088-45b5-8579-6ebefb71eb53", "version": "710900388", "external-name": "test-repo/test.yaml", "requeue-after": "2024-05-31T02:16:38Z"}
2024-05-30T02:16:38Z    DEBUG   provider-github Running terraform   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "args": ["apply", "-auto-approve", "-input=false", "-lock=false", "-json"]}
2024-05-30T02:16:38Z    DEBUG   events  Successfully requested update of external resource  {"type": "Normal", "object": {"kind":"RepositoryFile","name":"testfile","uid":"c29b04b2-9088-45b5-8579-6ebefb71eb53","apiVersion":"repo.github.upbound.io/v1alpha1","resourceVersion":"710900388"}, "reason": "UpdatedExternalResource"}
2024-05-30T02:16:41Z    DEBUG   provider-github apply async ended   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "out": "{\"@level\":\"info\",\"@message\":\"Terraform 1.3.6\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:38.189914Z\",\"terraform\":\"1.3.6\",\"type\":\"version\",\"ui\":\"1.0\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refreshing state... [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:38.620254Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_start\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refresh complete [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:39.133501Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_complete\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Plan to update\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:39.137655Z\",\"change\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\"},\"type\":\"planned_change\"}\n{\"@level\":\"info\",\"@message\":\"Plan: 0 to add, 1 to change, 0 to destroy.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:39.137706Z\",\"changes\":{\"add\":0,\"change\":1,\"remove\":0,\"operation\":\"plan\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Modifying... [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:39.415590Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\",\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"apply_start\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Modifications complete after 3s [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:41.681161Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\",\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\",\"elapsed_seconds\":3},\"type\":\"apply_complete\"}\n{\"@level\":\"info\",\"@message\":\"Apply complete! Resources: 0 added, 1 changed, 0 destroyed.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:41.690609Z\",\"changes\":{\"add\":0,\"change\":1,\"remove\":0,\"operation\":\"apply\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"Outputs: 0\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:41.690649Z\",\"outputs\":{},\"type\":\"outputs\"}\n"}
2024-05-30T02:16:41Z    DEBUG   provider-github Reconcile request has been requeued.    {"gvk": "repo.github.upbound.io/v1alpha1, Kind=RepositoryFile", "name": "testfile", "rateLimiterName": "", "when": "0s"}
2024-05-30T02:16:41Z    DEBUG   provider-github Reconciling {"controller": "managed/repo.github.upbound.io/v1alpha1, kind=repositoryfile", "request": {"name":"testfile"}}
2024-05-30T02:16:41Z    DEBUG   provider-github Running terraform   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "args": ["apply", "-refresh-only", "-auto-approve", "-input=false", "-lock=false", "-json"]}
2024-05-30T02:16:42Z    DEBUG   provider-github refresh ended   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "out": "{\"@level\":\"info\",\"@message\":\"Terraform 1.3.6\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:41.754242Z\",\"terraform\":\"1.3.6\",\"type\":\"version\",\"ui\":\"1.0\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refreshing state... [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:42.328255Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_start\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refresh complete [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:42.919152Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_complete\"}\n{\"@level\":\"info\",\"@message\":\"Plan: 0 to add, 0 to change, 0 to destroy.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:42.920846Z\",\"changes\":{\"add\":0,\"change\":0,\"remove\":0,\"operation\":\"plan\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"Apply complete! Resources: 0 added, 0 changed, 0 destroyed.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:42.923183Z\",\"changes\":{\"add\":0,\"change\":0,\"remove\":0,\"operation\":\"apply\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"Outputs: 0\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:42.923202Z\",\"outputs\":{},\"type\":\"outputs\"}\n"}
2024-05-30T02:16:42Z    DEBUG   provider-github Running terraform   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "args": ["plan", "-refresh=false", "-input=false", "-lock=false", "-json"]}
2024-05-30T02:16:43Z    DEBUG   provider-github plan ended  {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "out": "{\"@level\":\"info\",\"@message\":\"Terraform 1.3.6\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:42.946881Z\",\"terraform\":\"1.3.6\",\"type\":\"version\",\"ui\":\"1.0\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Plan to update\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:43.404050Z\",\"change\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\"},\"type\":\"planned_change\"}\n{\"@level\":\"info\",\"@message\":\"Plan: 0 to add, 1 to change, 0 to destroy.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:43.404140Z\",\"changes\":{\"add\":0,\"change\":1,\"remove\":0,\"operation\":\"plan\"},\"type\":\"change_summary\"}\n"}
2024-05-30T02:16:43Z    DEBUG   provider-github Called plan on the resource.    {"uid": "c29b04b2-9088-45b5-8579-6ebefb71eb53", "name": "testfile", "gvk": "repo.github.upbound.io/v1alpha1, Kind=RepositoryFile", "upToDate": false}
2024-05-30T02:16:43Z    DEBUG   provider-github Successfully requested update of external resource  {"controller": "managed/repo.github.upbound.io/v1alpha1, kind=repositoryfile", "request": {"name":"testfile"}, "uid": "c29b04b2-9088-45b5-8579-6ebefb71eb53", "version": "710900388", "external-name": "test-repo/test.yaml", "requeue-after": "2024-05-31T02:16:43Z"}
2024-05-30T02:16:43Z    DEBUG   provider-github Running terraform   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "args": ["apply", "-auto-approve", "-input=false", "-lock=false", "-json"]}
2024-05-30T02:16:43Z    DEBUG   events  Successfully requested update of external resource  {"type": "Normal", "object": {"kind":"RepositoryFile","name":"testfile","uid":"c29b04b2-9088-45b5-8579-6ebefb71eb53","apiVersion":"repo.github.upbound.io/v1alpha1","resourceVersion":"710900388"}, "reason": "UpdatedExternalResource"}
2024-05-30T02:16:46Z    DEBUG   provider-github apply async ended   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "out": "{\"@level\":\"info\",\"@message\":\"Terraform 1.3.6\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:43.431869Z\",\"terraform\":\"1.3.6\",\"type\":\"version\",\"ui\":\"1.0\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refreshing state... [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:43.873248Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_start\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refresh complete [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:44.353982Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_complete\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Plan to update\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:44.359938Z\",\"change\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\"},\"type\":\"planned_change\"}\n{\"@level\":\"info\",\"@message\":\"Plan: 0 to add, 1 to change, 0 to destroy.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:44.359993Z\",\"changes\":{\"add\":0,\"change\":1,\"remove\":0,\"operation\":\"plan\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Modifying... [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:44.696171Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\",\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"apply_start\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Modifications complete after 2s [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:46.738518Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\",\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\",\"elapsed_seconds\":2},\"type\":\"apply_complete\"}\n{\"@level\":\"info\",\"@message\":\"Apply complete! Resources: 0 added, 1 changed, 0 destroyed.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:46.744109Z\",\"changes\":{\"add\":0,\"change\":1,\"remove\":0,\"operation\":\"apply\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"Outputs: 0\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:46.744139Z\",\"outputs\":{},\"type\":\"outputs\"}\n"}
2024-05-30T02:16:46Z    DEBUG   provider-github Reconcile request has been requeued.    {"gvk": "repo.github.upbound.io/v1alpha1, Kind=RepositoryFile", "name": "testfile", "rateLimiterName": "", "when": "0s"}
2024-05-30T02:16:46Z    DEBUG   provider-github Reconciling {"controller": "managed/repo.github.upbound.io/v1alpha1, kind=repositoryfile", "request": {"name":"testfile"}}
2024-05-30T02:16:46Z    DEBUG   provider-github Running terraform   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "args": ["apply", "-refresh-only", "-auto-approve", "-input=false", "-lock=false", "-json"]}
2024-05-30T02:16:47Z    DEBUG   provider-github refresh ended   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "out": "{\"@level\":\"info\",\"@message\":\"Terraform 1.3.6\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:46.778906Z\",\"terraform\":\"1.3.6\",\"type\":\"version\",\"ui\":\"1.0\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refreshing state... [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:47.201556Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_start\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refresh complete [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:47.869980Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_complete\"}\n{\"@level\":\"info\",\"@message\":\"Plan: 0 to add, 0 to change, 0 to destroy.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:47.871711Z\",\"changes\":{\"add\":0,\"change\":0,\"remove\":0,\"operation\":\"plan\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"Apply complete! Resources: 0 added, 0 changed, 0 destroyed.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:47.874599Z\",\"changes\":{\"add\":0,\"change\":0,\"remove\":0,\"operation\":\"apply\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"Outputs: 0\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:47.874617Z\",\"outputs\":{},\"type\":\"outputs\"}\n"}
2024-05-30T02:16:47Z    DEBUG   provider-github Running terraform   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "args": ["plan", "-refresh=false", "-input=false", "-lock=false", "-json"]}
2024-05-30T02:16:48Z    DEBUG   provider-github plan ended  {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "out": "{\"@level\":\"info\",\"@message\":\"Terraform 1.3.6\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:47.892722Z\",\"terraform\":\"1.3.6\",\"type\":\"version\",\"ui\":\"1.0\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Plan to update\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:48.347825Z\",\"change\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\"},\"type\":\"planned_change\"}\n{\"@level\":\"info\",\"@message\":\"Plan: 0 to add, 1 to change, 0 to destroy.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:48.348065Z\",\"changes\":{\"add\":0,\"change\":1,\"remove\":0,\"operation\":\"plan\"},\"type\":\"change_summary\"}\n"}
2024-05-30T02:16:48Z    DEBUG   provider-github Called plan on the resource.    {"uid": "c29b04b2-9088-45b5-8579-6ebefb71eb53", "name": "testfile", "gvk": "repo.github.upbound.io/v1alpha1, Kind=RepositoryFile", "upToDate": false}
2024-05-30T02:16:48Z    DEBUG   provider-github Successfully requested update of external resource  {"controller": "managed/repo.github.upbound.io/v1alpha1, kind=repositoryfile", "request": {"name":"testfile"}, "uid": "c29b04b2-9088-45b5-8579-6ebefb71eb53", "version": "710900577", "external-name": "test-repo/test.yaml", "requeue-after": "2024-05-31T02:16:48Z"}
2024-05-30T02:16:48Z    DEBUG   provider-github Running terraform   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "args": ["apply", "-auto-approve", "-input=false", "-lock=false", "-json"]}
2024-05-30T02:16:48Z    DEBUG   events  Successfully requested update of external resource  {"type": "Normal", "object": {"kind":"RepositoryFile","name":"testfile","uid":"c29b04b2-9088-45b5-8579-6ebefb71eb53","apiVersion":"repo.github.upbound.io/v1alpha1","resourceVersion":"710900577"}, "reason": "UpdatedExternalResource"}
2024-05-30T02:16:51Z    DEBUG   provider-github apply async ended   {"workspace": "/tmp/c29b04b2-9088-45b5-8579-6ebefb71eb53", "out": "{\"@level\":\"info\",\"@message\":\"Terraform 1.3.6\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:48.374120Z\",\"terraform\":\"1.3.6\",\"type\":\"version\",\"ui\":\"1.0\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refreshing state... [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:48.787966Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_start\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Refresh complete [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:49.359626Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"refresh_complete\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Plan to update\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:49.363342Z\",\"change\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\"},\"type\":\"planned_change\"}\n{\"@level\":\"info\",\"@message\":\"Plan: 0 to add, 1 to change, 0 to destroy.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:49.363392Z\",\"changes\":{\"add\":0,\"change\":1,\"remove\":0,\"operation\":\"plan\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Modifying... [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:49.658691Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\",\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\"},\"type\":\"apply_start\"}\n{\"@level\":\"info\",\"@message\":\"github_repository_file.testfile: Modifications complete after 2s [id=test-repo/test.yaml]\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:51.813128Z\",\"hook\":{\"resource\":{\"addr\":\"github_repository_file.testfile\",\"module\":\"\",\"resource\":\"github_repository_file.testfile\",\"implied_provider\":\"github\",\"resource_type\":\"github_repository_file\",\"resource_name\":\"testfile\",\"resource_key\":null},\"action\":\"update\",\"id_key\":\"id\",\"id_value\":\"test-repo/test.yaml\",\"elapsed_seconds\":2},\"type\":\"apply_complete\"}\n{\"@level\":\"info\",\"@message\":\"Apply complete! Resources: 0 added, 1 changed, 0 destroyed.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:51.818327Z\",\"changes\":{\"add\":0,\"change\":1,\"remove\":0,\"operation\":\"apply\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"Outputs: 0\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2024-05-30T02:16:51.818361Z\",\"outputs\":{},\"type\":\"outputs\"}\n"}
2024-05-30T02:16:51Z    DEBUG   provider-github Reconcile request has been requeued.    {"gvk": "repo.github.upbound.io/v1alpha1, Kind=RepositoryFile", "name": "testfile", "rateLimiterName": "", "when": "0s"}
...
AtzeDeVries commented 1 week ago

HI @ilyalavrenov,

It looks like you are running into this issue https://github.com/integrations/terraform-provider-github/issues/689

AtzeDeVries commented 1 week ago

you should be able to resolve this using the initprovider (which this provider supports, although i have no experience with it yet..). https://docs.crossplane.io/latest/concepts/managed-resources/#initprovider