Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Skip terraform region validation for resources without region #115

Merged
merged 1 commit into from Oct 17, 2021
Merged

Skip terraform region validation for resources without region #115

merged 1 commit into from Oct 17, 2021

Conversation

turkenh
Copy link
Collaborator

@turkenh turkenh commented Oct 17, 2021

Description of your changes

Some resources, like iam group, do not have a notion of region hence we have no region in their schema.
However, terraform still attempts validating region in provider config and does not like both empty string or not setting it at all. We need to skip region validation in this case.

Fixes #112

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Create a user using the example
Delete user

Signed-off-by: Hasan Turken <turkenh@gmail.com>
@turkenh turkenh changed the title Skip region validation for resources without region Skip terraform region validation for resources without region Oct 17, 2021
@turkenh turkenh requested a review from muvaf October 17, 2021 12:22
@@ -83,6 +83,14 @@ func TerraformSetupBuilder(version, providerSource, providerVersion string) terr
// e.g. what about setting an assume_role section: https://registry.terraform.io/providers/hashicorp/aws/latest/docs#argument-reference
tfCfg := map[string]interface{}{}
tfCfg["region"] = awsConf.Region
if awsConf.Region == "" {
// Some resources, like iam group, do not have a notion of region
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Setting region with this value didn't work as well. Terraform returned not a valid region error.

Copy link
Member

@muvaf muvaf left a comment

Choose a reason for hiding this comment

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

Thanks @turkenh !

@github-actions
Copy link

Successfully created backport PR #116 for release-0.2.

@luebken
Copy link
Collaborator

luebken commented Oct 17, 2021

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IAM User Example is not working
3 participants