github-webhook
This component provisions a GitHub webhook for a single GitHub repository.
You may want to use this component if you are provisioning webhooks for multiple ArgoCD deployment repositories across GitHub organizations.
Usage
Stack Level: Regional
Here's an example snippet for how to use this component. This example pulls the value of the webhook from remote-state
components:
terraform:
webhook/cloudposse/argocd:
metadata:
component: github-webhook
vars:
github_organization: cloudposse
github_repository: argocd-deploy-non-prod
webhook_url: "https://argocd.ue2.dev.plat.cloudposse.org/api/webhook"
remote_state_github_webhook_enabled: true # default value added for visibility
remote_state_component_name: eks/argocd
SSM Stored Value Example
Here's an example snippet for how to use this component with a value stored in SSM
components:
terraform:
webhook/cloudposse/argocd:
metadata:
component: github-webhook
vars:
github_organization: cloudposse
github_repository: argocd-deploy-non-prod
webhook_url: "https://argocd.ue2.dev.plat.cloudposse.org/api/webhook"
remote_state_github_webhook_enabled: false
ssm_github_webhook_enabled: true
ssm_github_webhook: "/argocd/github/webhook"
Input Value Example
Here's an example snippet for how to use this component with a value stored in Terraform variables.
components:
terraform:
webhook/cloudposse/argocd:
metadata:
component: github-webhook
vars:
github_organization: cloudposse
github_repository: argocd-deploy-non-prod
webhook_url: "https://argocd.ue2.dev.plat.cloudposse.org/api/webhook"
remote_state_github_webhook_enabled: false
ssm_github_webhook_enabled: false
webhook_github_secret: "abcdefg"
ArgoCD Webhooks
For usage with the eks/argocd
component, see
Creating Webhooks with github-webhook
in that component's README.
Variables
Required Variables
github_organization
(string
) requiredThe name of the GitHub Organization where the repository lives
github_repository
(string
) requiredThe name of the GitHub repository where the webhook will be created
region
(string
) requiredAWS Region.
webhook_url
(string
) requiredThe URL for the webhook
Optional Variables
github_base_url
(string
) optionalThis is the target GitHub base API endpoint. Providing a value is a requirement when working with GitHub Enterprise. It is optional to provide this value and it can also be sourced from the
GITHUB_BASE_URL
environment variable. The value must end with a slash, for example:https://terraformtesting-ghe.westus.cloudapp.azure.com/
Default value:
null
github_token_override
(string
) optionalUse the value of this variable as the GitHub token instead of reading it from SSM
Default value:
null
remote_state_component_name
(string
) optionalIf fetching the Github Webhook value from remote-state, set this to the source component name. For example,
eks/argocd
.Default value:
""
remote_state_github_webhook_enabled
(bool
) optionalIf
true
, pull the GitHub Webhook value from remote-stateDefault value:
true
ssm_github_api_key
(string
) optionalSSM path to the GitHub API key
Default value:
"/argocd/github/api_key"
ssm_github_webhook
(string
) optionalFormat string of the SSM parameter path where the webhook will be pulled from. Only used if
var.webhook_github_secret
is not given.Default value:
"/github/webhook"
ssm_github_webhook_enabled
(bool
) optionalIf
true
, pull the GitHub Webhook value from AWS SSM Parameter Store usingvar.ssm_github_webhook
Default value:
false
webhook_github_secret
(string
) optionalThe value to use as the GitHub webhook secret. Set both
var.ssm_github_webhook_enabled
andvar.remote_state_github_webhook_enabled
tofalse
in order to use this valueDefault value:
""
Context Variables
The following variables are defined in the context.tf
file of this module and part of the terraform-null-label pattern.
context.tf
file of this module and part of the terraform-null-label pattern.Dependencies
Requirements
terraform
, version:>= 1.0.0
aws
, version:>= 4.0
github
, version:>= 4.0
Providers
aws
, version:>= 4.0
github
, version:>= 4.0
Modules
Name | Version | Source | Description |
---|---|---|---|
iam_roles | latest | ../account-map/modules/iam-roles | n/a |
source | 1.8.0 | cloudposse/stack-config/yaml//modules/remote-state | This can be any component that has the required output, github-webhook-value This is typically eks/argocd |
this | 0.25.0 | cloudposse/label/null | n/a |
Resources
The following resources are used by this module:
github_repository_webhook.default
(resource)
Data Sources
The following data sources are used by this module:
aws_ssm_parameter.github_api_key
(data source)aws_ssm_parameter.webhook
(data source)
References
- cloudposse/terraform-aws-components - Cloud Posse's upstream components