Skip to content

Conversation

@simonweil
Copy link
Contributor

@simonweil simonweil commented Jul 24, 2024

Description

Created a CircleCI OIDC provider and role

Motivation and Context

It's hard to do it on your own and I'm happy to contribute it to the community

Breaking Changes

None

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

Closes: #500

@simonweil simonweil force-pushed the feature/add-circleci-oidc-support branch from e924b64 to 45d3b35 Compare July 24, 2024 16:21
@simonweil
Copy link
Contributor Author

@antonbabenko why does CI fail on nullable = false in variables?
This is very useful to make sure defaults are used and unexpected nulls are not passed to the module.

@simonweil
Copy link
Contributor Author

@antonbabenko ping...

@simonweil
Copy link
Contributor Author

@bryantbiggs @antonbabenko any chance to get a go or no go?
I'm using my version of this module now for a around a month and all is good.

@antonbabenko
Copy link
Member

nullable requires terraform >= 1.1.0 but the module you add requires 1.0+.

If we decide that we need nullable, we need to update versions.tf to get pre-commit green. @bryantbiggs WDYT?

variable "org_uuid" {
description = "The CircleCI organization UUID that will be authorized to assume the role."
type = string
nullable = false
Copy link
Member

Choose a reason for hiding this comment

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

When create = false, the variables without default values must still be set since nullable is set to false. Right?

https://github.com/terraform-aws-modules/terraform-aws-iam/blob/master/examples/iam-github-oidc/main.tf#L57-L61


Please add examples for this module similar to https://github.com/terraform-aws-modules/terraform-aws-iam/blob/master/examples/iam-github-oidc/

Copy link
Contributor Author

@simonweil simonweil Aug 13, 2024

Choose a reason for hiding this comment

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

Yes. Thinking about it, what is the point in the create variable?
Will add the example.

@@ -0,0 +1,55 @@
locals {
# Just extra safety incase someone passes in a url with `https://`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Just extra safety incase someone passes in a url with `https://`
# Just extra safety in case someone passes in a url with `https://`
description = "Policies to attach to the IAM role in `{'static_name' = 'policy_arn'}` format"
type = map(string)
default = {}
nullable = false
Copy link
Member

Choose a reason for hiding this comment

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

Nullables are not needed in most places in the module. At least, I think so. We don't have them in pretty much any modules.

@bryantbiggs What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMHO, it is very useful to set nullable = false anywhere you do not expect to get nulls so you do not need to handle situations when null is set and there is an expected default. Also it is useful in sub modules for handling defaults by setting null in the input to make that default of the variable take place.

We do it for all our modules :)

But, your call, I can remove if you think it is better for the community.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see the value in using nullable - we haven't seen a use case yet where the resolution was to use nullable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

@bryantbiggs
Copy link
Member

in general - I don't like the idea of having a module per CI/CD provider. I know in the past I have pushed back when someone wanted to add a new module for Bamboo CI.

If we went forward, I would rather we create a module that is generic, and lets users opt into the different 3rd party provider (default) functionality. Something like iam-3rd-party-oidc-role or iam-integration-oidc-role and then we can support various integrations such as GitHub, GitHub Enterprise, Bamboo CI, CircleCI, etc. @antonbabenko what are your thoughts

@antonbabenko
Copy link
Member

I agree that we don't want to have a module per CI/CD provider, so let's update this PR to bring generic iam-integration-oidc-role and have a set of predifined properties per provider and a way to specify custom ones. It is also important to show the usages in examples.

In the longer run, we may discontinue the one we already have for GitHub.

@simonweil
Copy link
Contributor Author

I agree that we don't want to have a module per CI/CD provider, so let's update this PR to bring generic iam-integration-oidc-role and have a set of predifined properties per provider and a way to specify custom ones. It is also important to show the usages in examples.

In the longer run, we may discontinue the one we already have for GitHub.

Sounds good to me, I'll sketch up a direction for discussion

@github-actions
Copy link

This PR has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@github-actions github-actions bot added the stale label Sep 23, 2024
@simonweil
Copy link
Contributor Author

Don't close, I'm planning to get to it

@github-actions github-actions bot removed the stale label Sep 26, 2024
@github-actions
Copy link

This PR has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@github-actions github-actions bot added the stale label Oct 26, 2024
@github-actions
Copy link

github-actions bot commented Nov 6, 2024

This PR was automatically closed because of stale in 10 days

@github-actions github-actions bot closed this Nov 6, 2024
@github-actions
Copy link

github-actions bot commented Dec 6, 2024

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants