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: add OONI Dev User for GH actions #17

Merged
merged 27 commits into from
Mar 14, 2024
Merged

Conversation

DecFox
Copy link
Contributor

@DecFox DecFox commented Mar 13, 2024

This adds a new IAM user: ooni_dev_user which shall be used as the github user to run terraform apply. This IAM user has been given minimal ReadOnly permissions to resources which allow it to successfully run
terraform plan

Closes: #16

This adds a new IAM user: ooni_dev_user which shall
be used as the github user to run terraform apply. This
IAM user has been given minimal ReadOnly permissions
to resources which allow it to successfully run
`terraform plan`
@DecFox DecFox changed the title feat: add ooni_dev_user feat: add OONI Dev User for GH actions Mar 13, 2024
@DecFox DecFox changed the base branch from module-refactor to main March 13, 2024 11:52
@DecFox DecFox changed the base branch from main to module-refactor March 13, 2024 12:02
Copy link
Member

@hellais hellais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good! Thanks for putting it together.

I have left some comments on what should change before we can run it and merge it.

Copy link

github-actions bot commented Mar 13, 2024

Terraform Run Output 🤖

Format and Style 🖌success

Initialization ⚙️success

Validation 🤖success

Validation Output

$ terraform validate
Success! The configuration is valid.

Plan 📖success

  • undefined
Show Plan

$ terraform plan
Acquiring state lock. This may take a few moments...
Pusher @hellais
Action pull_request
Environment dev
Workflow .github/workflows/check_terraform.yml
Last updated Wed, 13 Mar 2024 21:07:03 GMT

@DecFox
Copy link
Contributor Author

DecFox commented Mar 13, 2024

Thanks for the feedback! I have made the required changes.

Copy link

github-actions bot commented Mar 13, 2024

Ansible Run Output 🤖

Ansible Playbook Recap 🔍



Ansible playbook output 📖success

Show Execution

$ ansible-playbook playbook.yml --check --diff -i ../tf/modules/ansible_inventory/inventories/inventory-dev.ini
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: clickhouse_servers

PLAY [ClickHouse servers] ******************************************************
skipping: no hosts matched

PLAY RECAP *********************************************************************

Pusher @hellais
Action pull_request
Working Directory
Workflow .github/workflows/check_ansible.yml
Last updated Wed, 13 Mar 2024 21:08:10 GMT

@hellais hellais merged commit 9064652 into module-refactor Mar 14, 2024
2 checks passed
@hellais hellais deleted the ooni-dev-user branch March 14, 2024 07:42
hellais added a commit that referenced this pull request Mar 14, 2024
This PR is to refactor the various resource groups into modules to make
it easier to develop the test environment.

See: #6

Also includes changes implemented by @DecFox

feat: add OONI Dev User for GH actions (#17)

This adds a new IAM user: ooni_dev_user which shall be used as the
github user to run terraform apply. This IAM user has been given minimal
ReadOnly permissions to resources which allow it to successfully run
`terraform plan`

---------

Co-authored-by: DecFox <33030671+DecFox@users.noreply.github.com>
hellais added a commit that referenced this pull request Mar 14, 2024
… Github User (#13)

Refactor the various resource groups into modules to make
it easier to develop the test environment.

See: #6

Convert to terraform the CodeBuild and CodePipeline projects that were
previously created through the web UI (fixes:
#12) and add support for an nginx
based API gateway (fixes: #7)

Also includes changes implemented by @DecFox

feat: add OONI Dev User for GH actions (#17)

This adds a new IAM user: ooni_dev_user which shall be used as the
github user to run terraform apply. This IAM user has been given minimal
ReadOnly permissions to resources which allow it to successfully run
`terraform plan`

Regarding CodeBuild and CodePipeline terraform conversion we made use the of the
terraformer tool running it like this:

```
terraformer import aws --resources=ec2,codebuild,codepipeline,iam --regions=eu-central-1
```

The output of this tool cannot be used as-is, but instead required a bit
of massaging to adapt it to the conventions used in the ooni terraform
scripts and hook it up to the existing variables, however it was very
helpful to bootstrap the config.

For the nginx API gateway, the actual configuration is still missing,
but the general idea is that we will have a Elastic Load Balancer rule
to forward requests to the nginx reverse proxy running in EC2 or the
dataapi running on ECS.

Note:

As part of this work I also did some refactoring of the names of some of
the resources and items inside of the terraform config. In doing so this
triggered a destruction and re-creation of all relevant resources, which
is I guess a nice lesson learned (I actually saw it from the plan, but
was curious to see what would happen).

In the future if we would like to do this kind of refactoring we should
be sure to make use of the `moved` syntax in terraform like this:
https://developer.hashicorp.com/terraform/language/modules/develop/refactoring#moved-block-syntax
or manually move the state by running `terraform mv`.

---------

Co-authored-by: DecFox <33030671+DecFox@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants