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

feat: Support AWS provider 4 #460

Merged
merged 18 commits into from
May 20, 2022
Merged

feat: Support AWS provider 4 #460

merged 18 commits into from
May 20, 2022

Conversation

npalm
Copy link
Collaborator

@npalm npalm commented Mar 7, 2022

See also #44

@npalm
Copy link
Collaborator Author

npalm commented Mar 7, 2022

@meMuszr At the moment I got a change every time I apply:

  # module.runner.module.cache.aws_s3_bucket_lifecycle_configuration.build_cache_versioning[0] will be updated in-place
  ~ resource "aws_s3_bucket_lifecycle_configuration" "build_cache_versioning" {
        id     = "12345678900-gitlab-runner-cache"
        # (1 unchanged attribute hidden)

      ~ rule {
            id     = "clear"
            # (1 unchanged attribute hidden)

          ~ expiration {
              ~ expired_object_delete_marker = false -> true
                # (1 unchanged attribute hidden)
            }

            # (1 unchanged block hidden)
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

@npalm
Copy link
Collaborator Author

npalm commented Mar 7, 2022

@meMuszr At the moment I got a change every time I apply:

  # module.runner.module.cache.aws_s3_bucket_lifecycle_configuration.build_cache_versioning[0] will be updated in-place
  ~ resource "aws_s3_bucket_lifecycle_configuration" "build_cache_versioning" {
        id     = "12345678900-gitlab-runner-cache"
        # (1 unchanged attribute hidden)

      ~ rule {
            id     = "clear"
            # (1 unchanged attribute hidden)

          ~ expiration {
              ~ expired_object_delete_marker = false -> true
                # (1 unchanged attribute hidden)
            }

            # (1 unchanged block hidden)
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

solved

@npalm npalm changed the title feat Support AWS provider 4 feat: Support AWS provider 4 Mar 7, 2022
@npalm npalm linked an issue Mar 7, 2022 that may be closed by this pull request
@meMuszr
Copy link
Contributor

meMuszr commented Mar 20, 2022

Hey - just a heads up - this doesn't work on 4.6 and 4.0. Pinned to 4.2 and it ran fine. Didn't really investigate further.
4.6 was erroring on ASG launch template's network interface device index.
4.0 was erroring on cache resource "aws_s3_bucket_lifecycle_configuration" filter

@npalm
Copy link
Collaborator Author

npalm commented Apr 9, 2022

Hey - just a heads up - this doesn't work on 4.6 and 4.0. Pinned to 4.2 and it ran fine. Didn't really investigate further. 4.6 was erroring on ASG launch template's network interface device index. 4.0 was erroring on cache resource "aws_s3_bucket_lifecycle_configuration" filter

Just tested with 4.7 and 4.9 all works fine

@kayman-mk
Copy link
Collaborator

kayman-mk commented May 6, 2022

Any chance to push this one? Just tested the runner-docker example with AWS provider 4.13. Everything fine. My jobs were processed.

Checked multiple terraform apply too. Looks good to me with Terraform 1.1.7.

@npalm
Copy link
Collaborator Author

npalm commented May 16, 2022

Sorry for all the delay, first syncing most PR's. Next merge this breaking change.

@npalm npalm force-pushed the aws-provider-4 branch from eb8c019 to f859090 Compare May 17, 2022 22:42
@npalm
Copy link
Collaborator Author

npalm commented May 17, 2022

PR is ready. Will update later this week the README and a notice of the upgrade and relase a new major version

@npalm
Copy link
Collaborator Author

npalm commented May 19, 2022

@kayman-mk this PR is finally ready. Will run tomorrow or Saturday one more last check. Next will run a reease.

meMuszr and others added 13 commits May 19, 2022 22:30
This introduces an Auto Scaling Group instance termination lifecycle
hook using Lambda and related resources. The Lambda function is a Python
script that is triggered when the persistent runner instance in the ASG
is terminated. The function receives the instance ID of the "parent"
runner and queries for spawned instances that it launched to terminate.
Additionally, it will check for other "orphaned" instances that have a
`gitlab-runner-parent-id` tag that doesn't match an existing instance. This
resolves the issue where spawned instances could be orphaned when their
parent runner is terminated.

This feature is disabled by default.

The user data script is updated to provide the 'parent' instance ID as a
tag named 'gitlab-runner-parent-id' on spawned instances.

A new sub-module is provided called "terminate-workers". It is optional
to use this feature, and the input variable
`asg_terminate_lifecycle_hook_create` can be toggled `true` or `false`
for this behavior.
* fix: add override for IAM objects name to all IAM resources

* fix: input variable for IAM object name override in cache module

* chore: update comment

* chore: revert unnecessary name changes

* chore: fix typo in description of overrides variable

* feat: add example for multi-region deployment

* docs: update readme

* docs: fix typo

* chore: apply review changes

* feat: remove protected runner setting from configuration
)

* chore: refactor master to main

* rebase

* feat: Upgrade default verions and drop support for Terraform < 0.15

* Set terraform version for submodules
)

* chore: refactor master to main

* rebase

* feat: Upgrade default verions and drop support for Terraform < 0.15

* Set terraform version for submodules
* remove the null resource

* amend the docs to not forget to remove the runner manually
* remove the null resource

* amend the docs to not forget to remove the runner manually
* remove the null resource

* amend the docs to not forget to remove the runner manually
@npalm npalm force-pushed the aws-provider-4 branch from f859090 to c2e3776 Compare May 19, 2022 20:34
npalm and others added 3 commits May 20, 2022 15:53
- set default the usage of metadata tokens to required
- refactor usages

close: #445

Co-authored-by: Matthias Kay <[email protected]>
BREAKING CHANGE: The module is upgraded to Terraform AWS provider 4.x. All new development will only support the new AWS Terraform provider. We keep a branch `terraform-aws-provider-3` to witch we welcome backports to AWS Terraform 3.x provider. Besides reviewing PR's we will do not any active checking on maintance on this branch. We strongly advise to update your deployment to the new provider version. For more details about upgrading see the [upgrade guide](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-4-upgrade).
BREAKING CHANGE:  By default AWS metadata service ((IMDSv2)[https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html]) is enabled and required for both the agent instance and the docker machine instance. For docker machine this require the GitLab managed docker machines distribution is used. Which the module usages by default.
@npalm npalm merged commit bced356 into develop May 20, 2022
semantic-releaser bot pushed a commit that referenced this pull request May 20, 2022
## [5.0.0](4.42.0...5.0.0) (2022-05-20)

### ⚠ BREAKING CHANGES

* The module is upgraded to Terraform AWS provider 4.x. All new development will only support the new AWS Terraform provider. We keep a branch `terraform-aws-provider-3` to witch we welcome backports to AWS Terraform 3.x provider. Besides reviewing PR's we will do not any active checking on maintance on this branch. We strongly advise to update your deployment to the new provider version. For more details about upgrading see the [upgrade guide](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-4-upgrade).
* By default, AWS metadata service ((IMDSv2)[https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html]) is enabled and required for both the agent instance and the docker machine instance. For docker machine this require the GitLab managed docker machines distribution is used. Which the module usages by default.

Co-authored-by: Matthias Kay <[email protected]>
Co-authored-by: Mustafa Abdul-Kader <[email protected]>
Co-authored-by: Steve Wilson <[email protected]>

### Features

* Terraform AWS Provider Version 4 Upgrade ([#460](#460)) ([bced356](bced356)), closes [#490](#490)
@semantic-releaser
Copy link
Contributor

🎉 This PR is included in version 5.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@kayman-mk kayman-mk deleted the aws-provider-4 branch January 14, 2023 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Supporting Terraform Provider 4
4 participants